大哥大姐帮忙把这个程序整一下,它怎麽调试通不过啊
提示: 作者被禁止或删除 内容自动屏蔽
#include<iostream> using namespace std; int main() { const int NUM = 10; struct Student { float total; char name[10]; }s[NUM]; int k, max, min; float x; for(k=0; k<NUM; k++) { cin>>s[k].total; cin>>s[k].name; } max = min = 0; for(k=1; k<NUM; k++) { if(s[max].total < s[k].total) { max=k; }//end if if(s[max].total > s[k].total) { min=k; }//end if }//end for cout<<"MAX "<<s[max].name<<", "<<s[max].total<<endl; cout<<"MIN "<<s[min].name<<", "<<s[min].total<<endl; return 0; }
#include<iostream> #include <string> using namespace std; struct Person { char name[20]; int number; char addr[30]; }; Person per[5]={ {"Wang Ming", 2749703, "103 Beijing Road"}, {"Li Hong", 2719838, "130 Nanjing Road"}, {"Guo Dong", 2738339, "120 Xi'an Road"}, {"Zhong Li", 2726225, "117 Zhongshan Road"}, {"Jing Zhuang", 2149719, "138 Jinan road"} }; int main() { int i, j = 0; char per_name[20]; cout<<"input per_name:"<<endl; gets(per_name); for (i=0; i<5; i++) { if (strcmp(per_name, per[i].name) == 0) { cout<<per[i].name<<" "<<per[i].number<<" "<<per[i].addr<<endl; break; }//end if else { j++; }//end else }//end for if (j == 5) { cout<<"There is no result!"<<endl; } return 0; }