fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. struct Student {
  7. string name;
  8. int scores[3];
  9. double average;
  10. };
  11.  
  12. int main() {
  13. string student s;
  14. cout << "enter student name:" << endl;
  15. cin >> s.name;
  16.  
  17. return 0;
  18. }
  19.  
Compilation error #stdin compilation error #stdout 0s 5320KB
stdin
Alex

compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13:17: error: expected initializer before ‘s’
  string student s;
                 ^
prog.cpp:15:9: error: ‘s’ was not declared in this scope
  cin >> s.name;
         ^
stdout
Standard output is empty