function

please help me in my coding..this is for my assingmnet.glad if u can help me correct the error


//assignment 3
//

#include<iostream>
#include<fstream>
#include<conio.h>
#include<math.h>
using namespace std;

int main()
{
fstream in,out;
ifstream inreferenceseq,seq,testseq;
ifstream intestsequence,intestsequence1,intestsequence2;
ofstream outFile;

char seq1,seq2,seq3,seq4,seq5,seq6,seq7,seq8,seq9,seq10;
char testseq1,testseq2,testseq3,testseq4,testseq5,testseq6,testseq7,testseq8,testseq9,testseq10;
int choice,penalty,sum;



inreferenceseq.open("referenceseq.txt",ios::in);
out.open("outdata.txt",ios::out);

inreferenceseq>>seq1;
inreferenceseq>>seq2;
inreferenceseq>>seq3;
inreferenceseq>>seq4;
inreferenceseq>>seq5;
inreferenceseq>>seq6;
inreferenceseq>>seq7;
inreferenceseq>>seq8;
inreferenceseq>>seq9;
inreferenceseq>>seq10;

cout << "reference seguence is as below " << endl << endl;

cout << seq1 << seq2 << seq3 << seq4 << seq5 << seq6 << seq7 << seq8 << seq9 << seq10 << endl << endl;

cout << "Which test sequence you want to use?"<<endl;
cout << "Press 1 for testseq1.txt, " << endl;
cout << "press 2 for testseq2.txt. : " <<endl<<endl;
cout << "choice : " ;
cin >> choice;
cout << endl <<endl;


while((choice==1)||(choice==2))
{
if(choice==1)
{
intestsequence1.open("testseq1.txt",ios::in);
out.open("outdata.txt",ios::out);
}

else if(choice==2)
{

intestsequence2.open("testseq2.txt",ios::in);
out.open("outdata.txt",ios::out);
}
{
intestsequence>>testseq1;
intestsequence>>testseq2;
intestsequence>>testseq3;
intestsequence>>testseq4;
intestsequence>>testseq5;
intestsequence>>testseq6;
intestsequence>>testseq7;
intestsequence>>testseq8;
intestsequence>>testseq9;
intestsequence>>testseq10;

cout << testseq1 << testseq2 << testseq3 << testseq4 << testseq5 << testseq6 << testseq7 << testseq8 << testseq9 << testseq10 << endl << endl;
}


out.close();
in.close();
system("pause");
getch();
return 0;
}
}

//function

int sum(int penalty);


{
if(seq==testseq)
{
penalty=0;
}

else if(seq!=testseq)
{
penalty=1;
}

else
{
penalty=2;
}

{
count++;
}
return count;
{







**error
# expected unqualified-id before '{' token
# expected `,' or `;' before '{' token



Well, your last { should be } and you have a semi colon after the line: int sum(int penalty); Fix those. Also, the variables you are using in the function sum don't exist within that scope.
Topic archived. No new replies allowed.