I'm trying write a program with a image shell(?),like a real software.
this is my simple code and how can i do..
#include <iostream>
using namespace std;
struct student{
char name[20];
int ID;
int score;
};
int main()
{
cout<<"How many students in the class?\nInput the number:"<<endl;
int n;
cin>>n;
student *a;
a=new student[n];
for (int i=0;i<n;i++){
cout<<"input the name of student "<<i+1<<" :"<<endl;
cin>>a[i].name;
cout<<"input "<<a[i].name<<"'s ID:"<<endl;
cin>>a[i].ID;
cout<<"input "<<a[i].name<<"'s score:"<<endl;
cin>>a[i].score;
}
for (int i=0;i<n;i++)
for (int j=i+1;j<n;j++)
if (a[i].score<a[j].score){
student tmp=a[i];
a[i]=a[j];
a[j]=tmp;
}
cout<<"===List of students==="<<endl;
cout<<"Name\tID\tscore\n";
for (int i=0;i<n;i++)
cout<<a[i].name<<'\t'<<a[i].ID<<'\t'<<a[i].score<<endl;
return 0;
}