cout<<"Please Enter Student Name: "<<endl;
cin>>student_name[30];
error C2678: binary '>>' : no operator found which takes a left-hand operand of type 'std::istream' (or there is no acceptable conversion)
the second one is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
avg = (Num_Ans/5)*100;
if((avg >= 90)&&(avg<=100))
cout<<"Your grade is an A"<<endl;
elseif ((avg >= 80)&&(avg<=89))
cout<<"Your grade is a B"<<endl;
elseif ((avg >= 70)&&(avg<=79))
cout<<"Your grade is a C"<<endl;
elseif ((avg >= 60)&&(avg<=69))
cout<<"Your grade is a D"<<endl;
elseif ((avg >= 0)&&(avg<=59))
cout<<"Your grade is a F"<<endl;
the error message says ecpected a deffinition on all of the if and else if lines
I have never experienced either one of these problems before and i have baffled by them
Thanks for any help
#include <iostream>
#include <string>
#include <iomanip>
the first error was line 37
usingnamespace std;
double avg;
struct StudentRecord
{
int ID;
string student_name[30];
string name;
char letter_grade;
};
struct Answers
{
char answer1;
char answer2;
char answer3;
char answer4;
char answer5;
};
struct key
{
char key1;
char key2;
char key3;
char key4;
char key5;
};
void getInformation(StudentRecord student_name[],int& ID)
{
cout<<"Please Enter Student Name: "<<endl;
cin>>student_name[30];
cout<<"Please Enter Student Id Number "<<endl;
cin>>ID;
cout<<"Please enter the student's answer to question 1: "<<endl;
cin>>Answers.answer1;
cout<<"Please enter the students's answer to question 2: "<<endl;
cin>>Answers.answer2;
cout<<"Please enter the student's answer to question 3: "<<endl;
cin>>Answers.answer3;
cout<<"Please enter the student's answer to question 4: "<<endl;
cin>>Answers.answer4;
cout<<"Please enter the studen's answer to question 5: "<<endl;
cin>>Answers.answer5;
}
void entKey ()
{
cout<<"Please enter the answer to question 1: "<<endl;
cin>>key.key1;
cout<<"Please enter the answer to question 2: "<<endl;
cin>>key.key2;
cout<<"Please enter the answer to question 3: "<<endl;
cin>>key.key3;
cout<<"Please enter the answer to question 4: "<<endl;
cin>>key.key4;
cout<<"Please enter the answer to question 5: "<<endl;
cin>>key.key5;
}
void calculateAvgAndLetter(StudentRecord student[], int number_of_students, char[])
{ int cal1,cal2,cal3,cal4,cal5;
char lttrgrade;
if (Answers.answer1 = key.key1)
cal1=1
else
cal1=0;
if (Answers.answer2 = key.key2)
cal2=1;
else
cal2=0;
if (Answers.answer3 = key.key3)
cal3=1;
else
cal3=0;
if (Answers.answer4 = key.key4)
cal4=1;
else
cal4=0;
if (Answers.answer5 = key.key5)
cal5=1;
else
cal5=0;
}
double Num_Ans = cal1+cal2+cal3+cal4+cal5;
double score= Num_Ans;
double avg = (Num_Ans/5)*100;
if((avg >= 90)&&(avg<=100))
cout<<"Your grade is an A"<<endl;
elseif ((avg >= 80)&&(avg<=89))
cout<<"Your grade is a B"<<endl;
elseif ((avg >= 70)&&(avg<=79))
cout<<"Your grade is a C"<<endl;
elseif ((avg >= 60)&&(avg<=69))
cout<<"Your grade is a D"<<endl;
elseif ((avg >= 0)&&(avg<=59))
cout<<"Your grade is a F"<<endl;
int main()
{
return 0;
}