QUESTION 1 100 points Write a CPP program that performs the following 1. (20 poi
ID: 3755230 • Letter: Q
Question
QUESTION 1 100 points Write a CPP program that performs the following 1. (20 points) Declares a structure data type named Stemp to hold the following information about a student: identification number (integer), number of credits completed (integer), cumulative grade point average k) 2. (20 points) Creates an array of 10 elements of type Stemp 3. (20 points) Reads a file containing 10 data items that populate the array created in 2 4. (20 points) Displays the contents of the array after it has been populated 5. (10 points) Include a comment with your name, course code and date Submit the cpp file, the input file and a screenshot of a sample run (10 points) together in a zip file. Attach File Browse My Computer Browse Content Collection Browse Dropbox Click Save and Submit to save and submit. Click Save All Answers to save all answerExplanation / Answer
#include <iostream>
using namespace std;
struct Stemp
{
int id;
int creditcomplete;
double gradepoint;
};
int main()
{
// your code goes here
Stemp s1[10];
char ch;
for( int i=0;i<=9;i++)
{
cout<<"enetr student identification number :"<<endl;
cin>>s1[i].id;
cout<<"enter students no of credits completed :"<<endl;
cin>>s1[i].creditcomplete;
cout<<"enter students cumulative grade point avarage :"<<endl;
cin>>s1[i].gradepoint;
}
do
{
cout<<"enetr student rno whose information to be dispalyed";
int rno;
cin>>rno;
int flag=0;
for(int i=0;i<=9;i++)
{
if(s1[i].id==rno)
{
flag=1;
cout<<" student identification number :"<<s1[i].id<<endl;
cout<<" students no of credits completed :"<<s1[i].creditcomplete<<endl;
cout<<"students cumulative grade point avarage :"<<s1[i].gradepoint<<endl;
break;
}
}
if(!flag)
{
cout<<"sorry no such student exist"<<endl;
cout<<"Exiting.....Press a key... ";
exit(1);
}
cout<<"Want to display more ? (y/n).. ";
cin>>ch;
}while(ch=='y' || ch=='Y');
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.