C++ Classes Example Error :(

Hello Everybody I`m The Beginner of this Site and I know absolutely Nothing in C++ Classes...
My friend asked me to correct this example of C++ code:

// // // // // // // // // // // // //

#include <cstdlib>
#include <iostream>
#include <fstream>

using namespace std;

class student

{ public:
string name,surname; double score;


moswavle (string,string,double)
{ name="ana"; surname="lashxi"; score=9.9;}

int main()

{

string a,b,c,d; double e,f;

ifstream fin("data.txt");
fin>>a>>b>>c>>d>>e>>f;

student m1(), m2(a,b,e), m3(c,d,f);
ofstream fout("answer.txt");

if ( m1.score > m2.score && m1.score > m3.score )

fout<<m1.name<<m1.surname<<m1.score;

else if ( m2.score>m1.score && m2.score > m3.score )

fout<<m2.name<<m2.surname<<m2.score;

else fout <<m3.name<<m3.surname<<m3.score;

return 0;

}




well Here I think she wanted to Compare Students class scores to each other...
but couse I don`t Know The Syntax I can`t correct it. Anybody correct it Please
Thanks
There's no closing brace for the class.

The function moswavle needs a return type. Edit: Or is that supposed to be a constructor?

There's a section on classes with examples on this site here if you need to read up a bit on syntax. http://www.cplusplus.com/doc/tutorial/classes/
Last edited on
Sorry I wrote it as a mistake: moswavle = student sorry
Topic archived. No new replies allowed.