Может кто-нибудь поможет преобразовать код?
может кто-нибудь поможет преобразовать код с си++ в си
#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[i].name << endl; cout << M[i].v << endl; cout << M[i].autor << endl; cout << M[i].nositel << endl; cout << endl; } } void GetData(Inform *M,int N) { for (int i=0; i < N; i++) { cout << "NAZVANIE: "; cin >> M[i].name; cout << "OBIEM: "; cin >> M[i].v; cout << "AUTOR: "; cin >> M[i].autor; cout << "NOSITEL: "; cin >> M[i].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; } |
1) На С подключается stdio.h и ввод вывод осуществляется printf и scanf
2)Вместо i++ - i += 1 или i=i+1 C не знаю, ето так, что на глаза попало) |
Часовой пояс GMT +4, время: 06:22. |
Powered by vBulletin® Version 4.5.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.