• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            tianxuyuan

            置頂隨筆 #

            [置頂]自學class 可是做半天的題目 電腦上數據答案對了 提交是不對的 〔內附題目 我的答案〕

            怎么這樣這樣?
            下面是提交后的顯示:
            編譯失敗...|錯誤號:1

            MyProger\Prog69647.cpp:24: error: expected `;' before '(' token
            MyProger\Prog69647.cpp:27: error: expected `;' before "int"
            MyProger\Prog69647.cpp: In function `int main()':
            MyProger\Prog69647.cpp:59: error: 'class Student' has no member named 'add'

            高手們大俠們救命阿!
            //=====================
            #include<iostream>
            #include<iomanip>
            using namespace std;
            //---------------------------------------------
            class Student{
             string name;
              int mark;
               int classmark;
                char isganbu;
                char isxibu;
                int lw;
                int jxj;
            public :
             void set(string na, int ma, int cl, char isga,char isxi,int l, int jx){
               name=na;mark=ma;classmark=cl;isganbu=isga;isxibu=isxi;lw=l;jxj=jx;
              }
             bool isys();
             bool isws();
             bool iscj();
             bool isxb();
             bool isbj();

             void  sumjxj(){
              if(isys()) jxj+=8000;
              if(isws()) jxj+=4000;
              if(iscj()) jxj+=2000;
              if(isxb()) jxj+=1000;
              if(isbj()) jxj+= 850;
              }
             int add(& sum){
              sum=sum+jxj ;
             }
             int  mmax(string & name1,int & jxj1){
              if(jxj>jxj1){ name1=name;jxj1=jxj ;}
                }
            };
            //-------------------------------------
             bool Student::isys(){
              return (mark>80&&lw>0);
              }
              bool Student::isws(){
               return (mark>85&&classmark>80 );
              }
              bool Student::iscj(){
               return (mark>90);
               }
              bool Student::isxb(){
               return (mark>85&&isxibu=='Y');
               }
              bool Student::isbj(){
               return (classmark>80&&isganbu=='Y');
               }
            //---------------------------------------
            int main(){
             string name1=" "; int jxj1=0; int sum=0;
             int n; cin>>n;
             for(;n;n--){
              Student x;
              string na; int ma; int cl; char isga;char isxi;int l; int jx=0;
              cin>>na>>ma>>cl>>isga>>isxi>>l;
              //jx=0;
              x.set(na,ma,cl,isga,isxi,l,jx);
              x.sumjxj();

              x.add(sum);
              x.mmax(name1,jxj1);

              }
             cout<<name1<<'\n';
             cout<<jxj1<<'\n';
             cout<<sum<<'\n';
              }

            描述 Description
                某校的慣例是在每學期的期末考試之后發放獎學金。發放的獎學金共有五種,獲取的條件各自不同:

              1)  院士獎學金,每人8000元,期末平均成績高于80分(>80),并且在本學期內發表1篇或1篇以上論文的學生均可獲得;

              2)  五四獎學金,每人4000元,期末平均成績高于85分(>85),并且班級評議成績高于80分(>80)的學生均可獲得;

              3)  成績優秀獎,每人2000元,期末平均成績高于90分(>90)的學生均可獲得;

              4)  西部獎學金,每人1000元,期末平均成績高于85分(>85)的西部省份學生均可獲得;

              5)  班級貢獻獎,每人850元,班級評議成績高于80分(>80)的學生干部均可獲得;

              只要符合條件就可以得獎,每項獎學金的獲獎人數沒有限制,每名學生也可以同時獲得多項獎學金。例如姚林的期末平均成績是87分,班級評議成績82分,同時他還是一位學生干部,那么他可以同時獲得五四獎學金和班級貢獻獎,獎金總數是4850元。

              現在給出若干學生的相關數據,請計算哪些同學獲得的獎金總數最高(假設總有同學能滿足獲得獎學金的條件)。
            輸入格式 Input Format
                輸入的第一行是一個整數N(1 <= N <= 100),表示學生的總數。接下來的N行每行是一位學生的數據,從左向右依次是姓名,期末平均成績,班級評議成績,是否是學生干部,是否是西部省份學生,以及發表的論文數。姓名是由大小寫英文字母組成的長度不超過20的字符串(不含空格);期末平均成績和班級評議成績都是0到100之間的整數(包括0和100);是否是學生干部和是否是西部省份學生分別用一個字符表示,Y表示是,N表示不是;發表的論文數是0到10的整數(包括0和10)。每兩個相鄰數據項之間用一個空格分隔。
            輸出格式 Output Format
                輸出包括三行,第一行是獲得最多獎金的學生的姓名,第二行是這名學生獲得的獎金總數。如果有兩位或兩位以上的學生獲得的獎金最多,輸出他們之中在輸入文件中出現最早的學生的姓名。第三行是這N個學生獲得的獎學金的總數。

            in
            4
            YaoLin 87 82 Y N 0
            ChenRuiyi 88 78 N Y 1
            LiXin 92 88 N N 0
            ZhangQin 83 87 Y N 1
            out
            ChenRuiyi
            9000
            28700

            posted @ 2007-08-16 23:01 田旭園 閱讀(681) | 評論 (5)編輯 收藏

            [置頂]放假在家 學習類 今天編了日期簡單處理的

            //===========================
            #include<iostream>
            #include<iomanip>
            //========================
            using namespace std;
            class Date{
             int year,month,day;
            public:
             bool isleapyear(){
               return(year%4==0&&year%100!=0)||(year%400==0);
               }
             void print(){
              cout<<setfill('0');
              cout<<setw(4)<<year<<'-'<<setw(2)<<month<<'-'<<setw(2)<<day<<'\n';
              cout<<setfill(' ');
              }
              void set(int y,int m,int d){
               year=y;  month=m; day=d;
              }
             };
            //--------------------------
            int main(){
             Date kk;
             int n;cin>>n;
             for(int i=1;i<=n;i++){
                int y;int m;int d;
                 cin>>y>>m>>d;                                   //  kk.set(1000,8,16);
                 kk.set(y,m,d);
                if(kk.isleapyear()) kk.print();
                 else cout<<"notleap\n";
              }
             cout<<"over"<<'\n';
            }
            //--------------------------

            想用類做8個排序算法 有點沒有頭緒阿

            posted @ 2007-08-16 11:15 田旭園 閱讀(333) | 評論 (1)編輯 收藏

            [置頂]待做

            Sorting by Swapping
            Time Limit:1000MS  Memory Limit:10000K
            Total Submit:2515 Accepted:1374

            Description
            Given a permutation of numbers from 1 to n, we can always get the sequence 1, 2, 3, ..., n by swapping pairs of numbers. For example, if the initial sequence is 2, 3, 5, 4, 1, we can sort them in the following way:

            2 3 5 4 1
            1 3 5 4 2
            1 3 2 4 5
            1 2 3 4 5

            Here three swaps have been used. The problem is, given a specific permutation, how many swaps we needs to take at least.


            Input
            The first line contains a single integer t (1 <= t <= 20) that indicates the number of test cases. Then follow the t cases. Each case contains two lines. The first line contains the integer n (1 <= n <= 10000), and the second line gives the initial permutation.

            Output
            For each test case, the output will be only one integer, which is the least number of swaps needed to get the sequence 1, 2, 3, ..., n from the initial permutation.

            Sample Input


            2
            3
            1 2 3
            5
            2 3 5 4 1

            Sample Output


            0
            3

            posted @ 2007-05-05 11:17 田旭園 閱讀(621) | 評論 (1)編輯 收藏

            僅列出標題  
            精品国产综合区久久久久久| 2021国产精品久久精品| 7国产欧美日韩综合天堂中文久久久久| 97精品久久天干天天天按摩 | 久久久精品午夜免费不卡| 国产成人无码精品久久久久免费 | 精品国产日韩久久亚洲| 狠狠色噜噜狠狠狠狠狠色综合久久| 国产精品久久久久久久久久免费| 久久久久亚洲AV无码专区首JN| 国产V综合V亚洲欧美久久| 色欲综合久久躁天天躁| 丁香狠狠色婷婷久久综合| 综合久久给合久久狠狠狠97色| 91久久婷婷国产综合精品青草| 无码8090精品久久一区| 久久精品黄AA片一区二区三区| 色综合合久久天天给综看| 精品无码久久久久久午夜| 久久久久免费精品国产| 人人狠狠综合88综合久久| 99久久精品费精品国产| 久久国产精品久久精品国产| 午夜精品久久久久久毛片| 久久久久久久综合狠狠综合| 久久久久97国产精华液好用吗| 欧美激情精品久久久久| 国产美女久久精品香蕉69| 一本色道久久88—综合亚洲精品| 色8激情欧美成人久久综合电| 久久久久久亚洲精品不卡 | 午夜精品久久久久久| 久久精品国产色蜜蜜麻豆 | 久久久久亚洲AV无码专区桃色| 国产精品对白刺激久久久| 久久亚洲私人国产精品vA | 婷婷综合久久中文字幕蜜桃三电影 | 久久免费线看线看| 亚洲成色999久久网站| 很黄很污的网站久久mimi色| 久久国产精品免费一区|