Answer to Question #251163 in C++ for asdasd

Question #251163

struct student

{

unsigned short studNum;

string name;

string course;

string yearLevel;

string section;

}


1
Expert's answer
2021-10-14T07:55:33-0400
#include<iostream>
using namespace std;
struct student


{


unsigned short studNum;


string name;


string course;


string yearLevel;


string section;


};


int main(){
	int n;
	cout<<"Enter the number of students to enter their details:\n";
	cin>>n;
	cout<<"Enter the details of "<<n<<" students\n";
	struct student stu[n];
	for(int i=0; i<n; i++){
		cout<<"Student "<<(i+1)<<":"<<endl;
		cout<<"Enter student number:\n";
		cin>>stu[i].studNum;
		cout<<"Enter the student name:\n";
		cin>>stu[i].name;
		cout<<"Enter the student course:\n";
		cin>>stu[i].course;
		cout<<"Enter the student year:\n";
		cin>>stu[i].yearLevel;
		cout<<"Enter the student section:\n";
		cin>>stu[i].section;
	}
	
	cout<<"The students' details are:\n";
	for(int i=0; i<n; i++){
	cout<<"Student "<<(i+1)<<":"<<endl;
    cout<<"Number:  "<<stu[i].studNum<<endl;
	cout<<"Name:  "<<stu[i].name<<endl;
	cout<<"Course:  "<<stu[i].course<<endl;
	cout<<"Year Level:  "<<stu[i].yearLevel<<endl;
	cout<<"Section:  "<<stu[i].section<<endl;


	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS