Может кто-нибудь поможет преобразовать код?
может кто-нибудь поможет преобразовать код с си++ в си
#include <iostream>
#include <string>
using namespace std;
struct Inform
{
string name;
int v;
string autor;
string nositel;
};
void ShowData(Inform *M, int N)
{
for (int i = 0; i < N; i++)
{
cout << M.name << endl;
cout << M.v << endl;
cout << M.autor << endl;
cout << M.nositel << endl;
cout << endl;
}
}
void GetData(Inform *M,int N)
{
for (int i=0; i < N; i++)
{
cout << "NAZVANIE: "; cin >> M.name;
cout << "OBIEM: "; cin >> M.v;
cout << "AUTOR: "; cin >> M.autor;
cout << "NOSITEL: "; cin >> M.nositel;
cout << endl;
}
}
int main()
{
int N; cout << "Vvedite N: "; cin >> N;
Inform *M = new Inform[N];
GetData(M, N);
ShowData(M, N);
delete [] M;
system("PAUSE");
return 0;
}
может кто-нибудь поможет преобразовать код с си++ в си
#include <iostream>
#include <string>
using namespace std;
struct Inform
{
string name;
int v;
string autor;
string nositel;
};
void ShowData(Inform *M, int N)
{
for (int i = 0; i < N; i++)
{
cout << M.name << endl;
cout << M.v << endl;
cout << M.autor << endl;
cout << M.nositel << endl;
cout << endl;
}
}
void GetData(Inform *M,int N)
{
for (int i=0; i < N; i++)
{
cout << "NAZVANIE: "; cin >> M.name;
cout << "OBIEM: "; cin >> M.v;
cout << "AUTOR: "; cin >> M.autor;
cout << "NOSITEL: "; cin >> M.nositel;
cout << endl;
}
}
int main()
{
int N; cout << "Vvedite N: "; cin >> N;
Inform *M = new Inform[N];
GetData(M, N);
ShowData(M, N);
delete [] M;
system("PAUSE");
return 0;
}