성적처리에서 10등까지의 학번과 성적을 산출하는 프로그램을 만드는데요ㅜㅜ
에다
질문 제목 :성적처리에서 10등까지의 학번과성적을 산출하는 프로그램을 만드는데요ㅜㅜ질문 요약 :빨간줄 표시된곳부터 막혀요ㅜㅠ 고수님들 도와주세요질문 내용 :
헤더파일
typedef struct student
{
char studentnumber;
float score;
} student;
int comparebyave (const void *e1,const void *e2);
void printstudent(const student* std, int num);
int comparebyave(const void *e1, const void *e2)
{
student *p1 = (student *) e1;
student *p2 = (student *) e2;
float temp = p2 -score - p1 - score ;
if(temp ==0)
return 0;
if (temp0)
return 1;
return -1;
}
=======================
cpp
#include stdio.h
#include stdlib.h
#include string.h
#include toa.h
void printstudent(const student* std, int num)
{
int i;
for(i=0 ; i10 ; i++)
printf(%-10s %5. %f\n,std[i].studentnumber, std[i].score);//문자 숫자 구별
}
int main()
{
int a=0;
int studentnumbers[60];
float score[60];
int i;
printf(this program is to find the top 10 of the class\n);
printf(how many students are there in your class?);
scanf(%d,a);//count수만큼 학생이 있습니다.
for(i=0; ia; i++)
{
printf(write down the codes and averages of students:);//학번과 성적을 입력하시오
scanf(%d %f,studentnumbers[i], score[i]);
}student std[100] =
{
for(i=0 ; ia ; i++)
{
{studentnumbers[i], score[i]}
}
};
qsort(std,10,sizeof(student),comparebyave);
printf(the rank would be \n);
printstudent(std,10);
getchar();
return 0;
}
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2700695 | 간단한 메모장 구현을 할려고 하는데요 (9) | 늘솜 | 2025-07-07 |
2700668 | c언어 질문입니다. 도와주세요~ (3) | 가자 | 2025-07-07 |
2700639 | 한글입력받아서 ㄱㄴㄷ순서대로출력하는법좀 | 두빛나래 | 2025-07-06 |
2700610 | 정말 기초적인 더하기,여백 문제 help | 무슬 | 2025-07-06 |
2700562 | 함수포인터에서요 (7) | 소심한여자 | 2025-07-06 |
2700530 | 전처리문 질문입니다. (1) | 아놀드 | 2025-07-05 |
2700510 | c언어를 어케하면 잘할수 있을까요.. | 연연두 | 2025-07-05 |
2700484 | 두 개가 차이가 뭔지 알려주세요...(소수 찾는 프로그램) (2) | 날위해 | 2025-07-05 |
2700426 | 인터넷 창 띄우는 질문이요 (1) | 정훈 | 2025-07-04 |
2700400 | 원넓이를 계산이요 ㅜㅜ | 천칭자리 | 2025-07-04 |
2700368 | if에 관해서 질문이요... | Orange | 2025-07-04 |
2700339 | 이거 결과값이 왜이런건지.. (4) | 그댸와나 | 2025-07-04 |
2700313 | 파일 읽어서 저장하는데 빈파일일 경우 문재가 발생하네요.. (2) | 크나 | 2025-07-03 |
2700287 | 구조체 동적할당 연습을 하는데 오류가 뜹니다...(해결) (3) | 아련나래 | 2025-07-03 |
2700264 | 문자와 숫자 동시에 입력??? | 글고운 | 2025-07-03 |
2700236 | txt파일로만 쓰고 읽게 하려면 어떻게 해야 하나요..?? (8) | 미국녀 | 2025-07-03 |
2700211 | 전위 연산자 (2) | 어른처럼 | 2025-07-02 |
2700183 | C에서 파일이름을 받고, 그 파일의 사이즈를 출력해줘야하는데 내용이 출력이 안되네요 ;ㅅ; | 피스케스 | 2025-07-02 |
2700150 | 꼭좀 도와주세요ㅠㅠㅠ | 호습다 | 2025-07-02 |
2700095 | 연산문제...질문... | 오빤테앵겨 | 2025-07-01 |