hello everyone...
i'm trying to call my cumputation in PRELIM ,MIDTERM , FINAL in my code but I don't know if there's something in my parameters.. it's just showing me this error "[Error] expected primary-expression before 'first name'". in line 45.
int main()
{
system ("color 5F");
system ("cls");
cout << "\t==============================================================" << endl;
cout << "\t| NORTHERN COLLEGE OF INFORMATION TECHNOLOGY AND COMPUTING |" << endl;
cout << "\t==============================================================" << endl << endl;
Start();
getch();
}
void Start(string id,string firstname,string lastname,float marks,float sum)
{
int choice;
back:
cout<<" NCITC Grade Portal :"<<endl;
cout<<"\t[1] Append Record "<<endl;
cout<<"\t[2] Browse all file contents "<<endl;
cout<<"\t[3] Find a record "<<endl;
cout<<"\t[4] Exit "<<endl;
cout<<"\t[5] About \n"<<endl;
cin>>choice;
switch (choice)
{
case 1:
system("cls");
AppendFile(string id,string firstname,string lastname,float marks,float sum);
Back();
break;
case 2:
system("cls");
BrowseFile();
Back();
break;
case 3:
system("cls");
FindRecord();
Back();
break;
case 4:
system("cls");
cout<<" Thank you . . .";
break;
case 5:
system("cls");
void ViewProfile();
break;
default:
cout<<"Invalid Entry ! . . . Try Again . . .\n";
system("cls");
break;
goto back;
system("cls");
}
}
void AppendFile(string id,string firstname,string lastname,float marks,float sum)
{
string id , firstname , lastname;
ofstream myfile;
myfile.open ("NCITC.txt");
cout<<" Student ID : ";
cin>> id;
cout<<"\n Student Name : ";
cin>>firstname>>lastname;
float marks[3][4]={0};
cout<<"\n Enter the marks of the student : "<<endl;
for(int count_1=0 ; count_1 < 3 ; count_1++)
{
cout<<"[1] = PRELIM\n"<<"[2] = MIDTERM\n"<<"[3] = FINAL\n";
cout<<"\n Enter the marks obtained by student in ["<< count_1+1 <<"] :"<<endl;
cout<<"\t Attendance/Assignment 10% (No. of Presence in 30 days)= ";
cin>>marks[count_1][0];
cout<<"\t SW/Labe Exercises 20% (total of 100)= ";
cin>>marks[count_1][1];
cout<<"\t Quizzes 30% (total of 150)= ";
cin>>marks[count_1][2];
cout<<"\t Exam 40% (total of 60)= ";
cin>>marks[count_1][3];
if(item_array[0]==id)
{
cout<<setfill('-')<<left<<setw(10)<<"\t\t\tID: " <<right<<" "<<item_array[0]<<endl;
cout<<setfill('-')<<left<<setw(10)<<"\t\t\tName: " <<right<<" "<<item_array[1]<<endl;
cout<<setfill('-')<<left<<setw(10)<<"\t\t\tGrade: " <<right<<" "<<item_array[2]<<endl;
cout<<""<<endl;
}
}
data.close();
}
void ViewProfile()
{
cout<<endl;
cout<<" Your School Here "<<endl;
cout<<" Addres here "<<endl;
cout<<" Contact number"<<endl;
cout<<" Subject"<<endl;
back();
}
void Back()
{
string choice;
cout<<""<<endl;
cout<<"Do you want to make another choice?(yes/no)";
cin>>choice;
system("cls");
cout<<""<<endl;
if (choice=="yes")
{
start();
}
else if(choice=="no")
{
cout<<" Thankyou and have a nice day !...";
}
}
Line 3. Wrong header. <string.h> is a C header. You want <string> for C++.
Line 45: You're supplying type names on a function call. Type names are not allowed in function calls.
Line 76, 84: You're declaring variables already declared as arguments. You can't do that. The compiler reports duplicate definitions.
Line 84: marks is declared as a simple float in the argument list. Here you're trying to declare it as an array. You can't have it both ways.
Line 119: AppendFile is declared a void function, but you're trying to return a value.
Lines 130-132: myfile is not defined.
Line 171: You're trying to use a stringstream, but you did not include the <sstream> header.
Line 201: No forward declaration for back().
Line 213: start is not defined.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.