返回列表 發帖
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int a[6]={48,49,52,50,47,51};
  6.     int b=0;
  7.     for(int i=0; i<=5; i++)
  8.     {
  9.           cout<<"5年"<<i+1<<"班有"<<a[i]<<"人"<<endl;
  10.                  
  11.     }
  12.     for(int i=0; i<=5;  i++)
  13.     {
  14.         b=b+a[i];  
  15.     }
  16.     cout<<"5年級共有"<<b<<"人"<<endl;
  17.     system("pause");
  18.     return 0;  

  19. }
複製代碼

TOP

返回列表