分类：电脑/网络
问题：请高手帮我编一下程序。我搞了半天都搞不好。Assume30stu 
我搞了半天都搞不好。Assume 30 students are in a class. Generate random numbers ranging f 50 to 100 to be the score of each student. Using the calculations in the last problem, find the frequency of each letter grade, that is, the number of students in each letter grade. Print the n我搞了半天都搞不好。Assume 30 students are in a class. Generate random numbers ranging f 50 to 100 to be the score of each student. Using the calculations in the last problem, find the frequency of each letter grade, that is, the number of students in each letter grade. Print the number of students getting an “A”, a “B”, a “C, a “D” and an “F” separately.
回答：必要： 
#include <stdlib.h> 

代码： 
int StudentLV[5] = {0}; 

for(int i=0; i<50; i++) 
{ 
int nRand = rand()%5; 
StudentLV[nRand]++; 
} 

char szTemp[1024] = {"\0"}; 
sprintf(szTemp, "A student:%d, B student:%d, C student:%d, D student:%d, E student:%d", StudentLV[0], StudentLV[1], StudentLV[2], StudentLV[3], StudentLV[4]); 
CString str = szTemp; 
MessageBox(str, "result");