1.

Solve : constructor destructor error and sntax error?

Answer»

I have written a code that is surpose to output questions from a file after that the program should input all the answers to an array then afterwards close the file. in implementation program the answers program should re-open to allow me to read the answers from the answers file and check whether they are correct or not.

THE PROBLEM IS THAT THIS KEEPS ON GIVING ME THE SAME ERROR WHICH IS IN LINE 10 ("expected constructor,destructor or some kind of conversion before .")

if anyone has an idea on how I should GO about solving this problem COULD he or she PLZ reply. thanks in advance.

#include
#include
#include
#include
using namespace std;
#include"final.h"


//fstream funda;
//funda.open("answers.txt",ios::in)



/*if(funda.fail())
{
cerr<<"could not open ditails file"<exit(1);
}*/

final::final()
{
}
final::final(string n,string id)
{

setname(n);
setstudnum(id);
getname();
getstudnum();
//setanswers();
//getanswers();



}

/*void final::setanswers()
{ char h;
for(int n=0;n<10;n++)
{
while(h!=' ')
{cin.ignore();
funda>>h;
ans[n]=h;
}
h='a';
}

}*/
int final::getscore()
{
return SCORE;
}

void final::setname(string n)
{
name=n;
}

void final::setstudnum(string id)
{
studnum=id;
}

void final::checkanswer()
{
char correct[10]={'B','B','B','D','C','C','B','A','C','C'};

ans[10];
int score=0;

for(int j=0;j<10;j++)
{
if(correct[j]==ans[j])
{
score+=3;
}
else
{score-=3;}
}
//funda.close();
}
string final::getname()
{
return name;
}
string final::getstudnum()
{
return studnum;
}

this is the implimentation program



Discussion

No Comment Found