Hi :)
I was trying to write a read function. But I'm getting the following errors. Could you please tell me the reason for these errors? Thanks a lot.
error: stray '\224' in program| error: stray '\224' in program| error: stray '\224' in program| error: stray '\224' in program| error: stray '\224' in program| error: stray '\224' in program| In function 'STUDENT readdata()':| error: 'enter' was not declared in this scope| error: expected ';' before 'the'| error: expected ';' before 'sex'| error: expected ';' before 'the'| ||=== Build finished: 10 errors, 0 warnings ===|
// user defined read function using structure
#include <iostream>
#include <cstdlib>
using namespace std;
/////////////////////////////////////////////
struct STUDENT { int rollno; char sexcode; float marks;};
/////////////////////////////////////////////
//------------------------------------------
STUDENT readdata( )
{
STUDENT s;
cout << ”enter the roll no.: ”;
cin >> s.rollno;
cout << ”enter sex code: ”;
cin >> s.sexcode;
cout << ”enter the marks: ”;
cin >> s.marks;
return (s);
}
//--------------------------------------------
int main( )
{
int i; STUDENT s1;
s1 = readdata( );
cout << "roll no.: " << s1.rollno << endl;
cout << "sex code: " << s1.sexcode << endl;
cout << "marks: " << s1.marks << endl;
system("pause");
return 0;
}


Sign In
Create Account


Back to top









