字串排序的問題~ |
答題得分者是:GeorgeKu
|
tai1688
一般會員 發表:9 回覆:12 積分:4 註冊:2005-03-15 發送簡訊給我 |
昨天經blk5743大大的教導,決定用自己的方法來做,終於做出來了~可是他字串排列的怪怪的,只有第一行排列正確~拜託各位高手幫我修改一下我的字串sort的code~感激不盡~
p5.dat(原始檔)
---------------------------------------------
3211 Smith, Jimmy 76.0 80.0 85.5 83.0
4321 Adams, Jane 94.0 100.0 97.5 0.0
1234 Wang, Andy 70.5 77.0 85.0 82.0
5678 Johnson, susan 78.5 66.5 72.0 69.0
9320 Williams, Donald 72.0 55.0 66.0 45.0
5436 Garcia, Juan 84.0 82.0 77.5 91.0
1235 Nguyen, Vickie 86.0 99.0 88.5 92.0
6324 Jackson, Janet 80.0 88.0 100.0 88.0
2358 Vargas, Fernado 72.5 68.0 80.0 70.0
5000 Smith, Jane 20.0 75.0 68.0 92.0
1111 Williamson, David 76.0 50.0 66.0 80.0
5555 Johnson, Alexander 76.5 70.5 72.0 66.0
3400 Wong, Suzy 60.0 60.0 60.0 60.0
9876 Johnson, Doug 99.5 100.0 100.0 100.0
==============================================
p5out.dat(輸出檔)
-------------------------------------------------
Id Name Hw Project Exam Final Percent Grade
-------------------------------------------------------------------
4321 Adams, Jane 94.0 100.0 97.5 0.0 72.9 C
3211 Smith, Jimmy 76.0 80.0 85.5 83.0 81.1 B
5678 Johnson, susan 78.5 66.5 72.0 69.0 71.5 C
1234 Wang, Andy 70.5 77.0 85.0 82.0 78.6 C
5436 Garcia, Juan 84.0 82.0 77.5 91.0 83.6 B
1235 Nguyen, Vickie 86.0 99.0 88.5 92.0 91.4 A
6324 Jackson, Janet 80.0 88.0 100.0 88.0 89.0 B
2358 Vargas, Fernado 72.5 68.0 80.0 70.0 72.6 C
5000 Smith, Jane 20.0 75.0 68.0 92.0 63.8 D
9320 Williams, Donald 72.0 55.0 66.0 45.0 59.5 F
5555 Johnson, Alexander 76.5 70.5 72.0 66.0 71.3 C
1111 Williamson, David 76.0 50.0 66.0 80.0 68.0 D
9876 Johnson, Doug 99.5 100.0 100.0 100.0 99.9 A
3400 Wong, Suzy 60.0 60.0 60.0 60.0 60.0 D
====================================================================
#include |
GeorgeKu
中階會員 發表:1 回覆:120 積分:74 註冊:2004-10-13 發送簡訊給我 |
tai1688, 我把你sort的部分改為如下
void sort(person Person[],int a) { person temp; int j=0,c=1; for(int i=0;i0){ temp=Person[i]; Person[i]=Person[j]; Person[j]=temp; } } c ; } } |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |