일단 컴파일 에러만 잡아줬다. 주석달았으니 알아서 보고 질문있음 해라.
#include<iostream>
#include<string>
using namespace std;
struct Student {
string name;
long no;
double score;
};
void bubbleSort(Student s[], int n)
{
int i, j;
Student temp; // error "struct" no!!!
for (i = 0; i<n - 1; i++) {
for (j = 1; j<n - 1; j++) {
if (s[j - 1].score>s[j].score) // error struct compare??? no!!! socre compare
{
temp = s[j - 1];
s[j - 1] = s[j];
s[j] = temp;
}
}
}
} // error close nothing
void main()
{
int n;
cout << "학생 수를 입력하세요.:";
cin >> n;
Student *s = new Student[n];
for (int i = 0; i < n; i++)
{
cout << "이름:";
cin >> s[i].name;
cout << "학번:";
cin >> s[i].no;
cout << "점수:";
cin >> s[i].score;
cout << endl;
}
delete[] s;
system("pause");
}
이렇게 알려줘도 고맙단말 한마디 없다니 학식충과제질문 해주지말자