#include <iostream>
#include <cstring> // i don't think it's needed but i used it because of some compilers
usingnamespace std;
int main() {
string student_name[4];
for( int i = 0; i < 4; ++i )
cin >> student_name[i];
for( int i = 0; i < 4; ++i )
cout << student_name[i] << endl;
return 0;
}
@ vlad
no different ! I promise.
but it's better to know some header files like <math.h>, <string.h> and etc, have a newer version with some small complitions .
so for being standard & update i suggest using <cstring> or <cmath>
cstring does not contain the definition of C++ class std::string that you are using in your example. It contains standard C functions placed in the global namespace. That is it has nothing common with std;:string. That to use std::string you have to include header string without any prefix 'c'. By the way this prefix in C++ headers means that this header corresponds to some standard C header.