Saved Bookmarks
| 1. |
The following code sums up the total of all students name starting with ‘S’ and display it. Fill in the blanks with required statements.struct student {int exam no, lang, eng, phy, che, mat, csc, total; char name[15];};int main(){student s[20];for(int i = 0;i<20;i++){……….. //accept student details}for(int i=0;i<20;i++){………….. //check for name starts with letter “S”………….. // display the detail of the checked name}return 0;} |
|
Answer» struct student { int exam_no, lang, eng, phy, chem, mat, csc, total; char name[15]; } int main() { student s[20]; for(int i = 0;i<20;i++) { cout<<"\n Enter the exam number of student:"; cin>>s[i].exam_no.; cout<<"\n Enter language names:"; cin>>s[i].lang; cout<<"\ Enter name of the Student:"; cin>>s[i].Name; } for(int i =0;i<20; i++) { if (s[i],name[0]=='s') { cout<<"student name:"<<s[i].name; cout<<"student Exam number"; } } return 0;} |
|