herrDeng網內搜尋

自訂搜尋

Ads

2010年4月6日 星期二

用 C/C++算上學期加權平均

用 C/C++算上學期加權平均

54 則留言:

b9833xxx 提到...

#include <iostream>
using namespace std;
int main(){....}

B9833123 提到...

#include
using namespace std;
int main()
{
int t[12]={87,82,83,60,72,75,63,69,68,76,88,81};
int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21;
int sum=0;
float average;
for (int i=0;i<12;i++)
{
sum+=t[i]*c[i];
}
cout<<sum<<endl;
average=(float)sum/21;
cout<<average;
system("Pause");
return 0;
}

B9833135 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={82,60,85,49,63,80,82,97,85,86,80,72};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
        sum+=t[i]*c[i];
    cout<<sum<<"\n";
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

B9833124 提到...

#include <iostream>

using namespace std;

int main()

{

    const int n=12;

    int t[n]={82,70,85,76,79,97,85,96,76,87,93,88};

    int c[n]={0,2,0,2,2,3,3,3,3,3,0,0};

    int cc=21;

    int sum=0;

    float average;

    for(int i=0;i<12;i++)

    {

     sum+=t[i]*c[i];

    }

    cout<<sum<<endl;

    average=(float)sum/cc;

    cout<<average;

    system("pause");

    return 0;
}

B9833158 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={82,66,80,77,83,76,81,76,83,85,82,71};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
         sum+=t[i]*c[i];
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

B9833167 提到...

#include
using namespace std;
int main()
{
int t[12]={84,81,71,60,80,92,68,72,64,71,84,74};
int c[12]={ 0, 2, 0, 2, 2, 3, 3, 3, 3, 3, 0, 0};
int cc=21;
int sum = 0;
float average;
for(int i=0; i<12;i++)
{
sum+=t[i]*c[i];
}
cout<<sum<<endl;
average=(float)sum/21;
cout<<average;
system("pause");
return 0;
}

B9833161 提到...

#include
using namespace std;
int main()
{
int t[12]={87,69,80,74,78,98,81,83,69,85,82,70};
int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21;
int sum=0;
float average;
for (int i=0;i<12;i++)
{
sum+=t[i]*c[i];
}
cout<<sum<<endl;
average=(float)sum/21;
cout<<average;
system("pause");
return 0;
}

B9833153 提到...

#include <iostream>
using namespace std;
int main()
{
    const int n=12;
    int t[n]={84,61,82,78,79,76,64,81,78,90,90,74};
    int c[n]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
    for (int i=0;i<12;i++)
    {
     sum+=t[i]*c[i];   
    }
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("pause");
    return 0;
}

B9833159 提到...

#include <iostream>
using namespace std;
int main()
    int t[12]={60,61,60,34,86,84,47,41,64,80,46,49}
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12 ;i++)
    {
    sum+=t[i]*c[i];
    }
   
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
   
    system("Pause");
    return 0;
   
}

B9833128 提到...

#include <iostream>

using namespace std;

int main()

{

    const int n=12;

    int t[n]={87,70,81,73,72,95,82,94,84,80,89,75};

    int c[n]={0,2,0,2,2,3,3,3,3,3,0,0};

    int cc=21;         

    int sum=0;

    float average;   

    for(int i=0;i<12;i++)

    {

     sum+=t[i]*c[i];
    }
    cout<<sum<<endl;    
    average=(float)sum/cc;

    cout<<average;    
    system("pause");

    return 0;
}

b9833121 提到...

#include
using namespace std;
int main()
{
int t[12]={82,75,80,84,75,74,65,75,74,80,91,75};
int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21;
int sum=0;
float average;
for (int i=0;i<12;i++)
{
sum+=t[i]*c[i];
}
cout<<sum<<endl;
average=(float)sum/21;
cout<<average;
system("pause");
return 0;
}

B9833130 提到...

#include <iostream>
using namespace std;
int main ()
{
    int t[12]={81,68,83,89,82,81,76,80,77,84,83,72};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for(int i=0; i<12; i++)
    {
    sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average= (float)sum/cc;
    cout<<average;
   
    system("pause");
    return 0 ;
}

B9833169 提到...

#include<iostream>
using namespace std;
int main()
{
    int t[12]={82,65,85,60,89,83,78,70,73,78,87,80};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
    for (int i=0;i<12;i++)
    {
        sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("pause");
    return 0;
}

b9833142 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={79,62,81,60,60,62,48,47,50,60,77,74};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
         sum+=t[i]*c[i];
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

b9833152 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={71,65,80,42,60,77,37,45,71,94,81,82};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
         sum+=t[i]*c[i];
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

b9833175 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={65,63,84,48,67,68,71,54,47,74,75,73};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
         sum+=t[i]*c[i];
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

B9833165 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={87,61,86,60,77,80,76,44,74,77,82,81};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12; i++)
    {
    sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average= (float)sum/cc;
    cout<<average;
   
    system("pause");
    return 0 ;
}

b9833154 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={71,65,80,42,60,77,37,45,71,94,81,82};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
         sum+=t[i]*c[i];
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

B9833131 提到...

#include<iostream>
using namespace std;
int main( )
{
    const int n=12;
    int t[n]={82,75,84,86,75,85,74,63,84,87,85,76};
    int c[n]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<n; i++)
    {
        sum+=t[i]*c[i];
    }
    cout<<sum<<"\n";
    average=(float)sum/cc;
    cout<<average;
   
    system("pause");
    return 0;
}

B9833174 提到...

#include
using namespace std;
int main ()
{
int t[12]={77,73,80,69,79,70,60,66,57,88,80,82};
int c[12]= {0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21;
int sum=0;
float average;
for (int i=0;i<12;i++)
{
sum+=t[i]*c[i];
}
cout<<sum<<endl;
average=(float)sum/21;
cout<<average;
system("pause");
return 0;
}

B9833170 提到...

#include <iostream>
using namespace std;
int main ()
{
    int t[12]={80,67,80,76,79,72,48,60,61,76,76,69};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
    {
        sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
   
    system("pause");
    return 0;
}

B9833125 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={81,68,88,74,76,75,80,67,73,84,90,83};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12; i++)
    {
    sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average= (float)sum/cc;
    cout<<average;
   
    system("pause");
    return 0;
}

b9833122 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={78,66,85,75,69,92,60,90,56,70,79,79};
    int c[12]={0,0,2,2,3,3,3,3,3,0,0,2};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12;i++)
    {
        sum+=t[i]*c[i];
    }
        cout<<sum<<endl;
        average=(float)sum/cc;
        cout<<average;
        system("pause");
        return 0;
}

b9833134 提到...

#include <iostream>
using namespace std;
int main ()
{
    int t[12]={76,69,85,60,81,93,74,75,54,75,74,69};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12; i++)
    {
        sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average=(float)sum/8;
    cout<<average;
   
    system("pause");
    return 0;
}

b9833172 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={69,72,80,61,60,60,66,61,55,70,76,75};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
         sum+=t[i]*c[i];
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

b9833150 提到...

#include <iostream>
using namespace std;
int main ()
{
    int t[12]={78,67,85,65,68,73,67,88,65,66,67,80};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
    {
        sum+=t[i]*c[i];
     }
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
   
    system("pause");
    return 0;   
}

b9833127 提到...

#include <iostream>
using namespace std;
int main ()
{
    int t[12]={80,79,82,62,68,78,63,70,68,72,87,82};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
    {
        sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
   
    system("pause");
    return 0;
}

B9833157 提到...

#include <iostream>
using namespace std;
int main()
{
    const int n=12;
    int t[12]={87, 80, 89, 80, 81, 90, 77, 92, 76, 88, 91, 80};
    int c[12]={0, 2, 0, 2, 2, 3, 3, 3, 3, 3, 0, 0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12; i++)
    {
        sum+=t[i];
    }
    cout<<sum<<endl;
    average=(float)sum/12;
    cout<<average;
    system("pause");
    return 0;
}

B9833133 提到...

#include<iostream>
using namespace std;
int main()
{
    const int n=12;
    int t[12]={82,72,90,87,83,93,83,83,76,84,88,69};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for(int i=0;i<12;i++)
    {
            sum+=t[i];
    }
    cout<<sum<<endl;
    average=(float)sum/12;
    cout<<average;
system("Pause");
return 0;
}

b9833137 提到...

#include
using namespace std;
int main()
{
const int n=12;
int t[n]={75,73,80,60,70,85,67,60,57,75,81,76};
int c[n]={0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21;
int sum=0;
float average;

for (int i=0; i<n;i++)
{
sum+=t[i]*c[i];
}
cout<<sum<<endl;
average= (float)sum/cc;
cout<<average;

system("pause");
return 0;
}

b9833147 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={61,68,82,68,71,45,60,38,55,60,68,65};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
         sum+=t[i]*c[i];
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

B9833157 提到...

#include <iostream>
using namespace std;
int main()
{
    const int n=12;
    int t[12]={87, 80, 89, 80, 81, 90, 77, 92, 76, 88, 91, 80};
    int c[12]={0, 2, 0, 2, 2, 3, 3, 3, 3, 3, 0, 0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12; i++)
    {
        sum+=t[i];
    }
    cout<<sum<<endl;
    average=(float)sum/12;
    cout<<average;
    system("pause");
    return 0;
}

B9833140 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={74,60,80,60,62,71,66,66,60,66,76,70};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0;i<12;i++)
    {
        sum+=t[i]*c[i];
     }
     cout<<sum<<endl;
     average=(float)sum/cc;
     cout<<average;
    
     system("Pause");
     return 0;
}

B9833177 提到...

#include <iostream>
using namespace std;
int main()
{
const int n=12 ;
int t[12]= {81,69,81,60,71,80,74,91,78,83,82,79};
int c[12]= {0,2,0,2,2,3,3,3,3,3,0,0};
int cc=0;
int bb=0;
float average;
for(int i=0;i<n;i++)
{
cc+=c[i];
bb+=t[i]*c[i];
}
average = (float)bb / cc;
cout<<"學分總和:"<<cc<<endl;
cout<<"學期總和:"<<bb<<endl;
cout<<"學期平均:"<<average<<endl;
system ("pause");
return 0;
}

b9833168 提到...

#include <iostream>
using namespace std;
int main ()
{
     int t[12]={68,60,81,60,74,74,65,60,56,60,70,83};
     int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
     int cc=21;
     int sum=0;
     float average;
     for (int i=0;i<12;i++)
     {
         sum+=t[i]*c[i];
     }
     cout<<sum<<endl;
     average=(float)sum/21;
     cout<<average;
     system("pause");
     return 0;

b9833151 提到...

#include <iostream>
using namespace std;
int main ()
{
int t[12]={76,69,85,60,70,60,74,70,60,75,74,69};
int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21;
int sum=0;
float average;
for (int i=0; i<12; i++)
{
sum+=t[i]*c[i];
}
cout<<sum<<endl;
average=(float)sum/8;
cout<<average;
system("pause");
return 0;
}

b9833143 提到...

#include
using namespace std;
int main()
{
const int n=12;
int t[]={81,60,80,60,60,72,60,41,60,63,75,73};
int c[]={0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21;
int sum=0;
float average;
for (int i=0; i<12; i++)
{
sum+=t[i]*c[i];
}
cout<<sum<<endl;
average=(float)sum/cc;
cout<<average;

system("PAUSE");
return 0;
}

b9833171 提到...

#include <iostream>
using namespace std;
int main()
{
const int n=12 ;
int t[n]= {79,72,81,60,80,97,79,72,78,81,82,80};
int c[n]= {0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21, sum=0;
float average;
for (int i=0;i<n;i++)
{
sum+=t[i]*c[i];
}
cout<<sum<< "\n";
average =(float)sum/cc;
cout<<average<<endl;
system("pause");
return 0 ;
}

B9833136 提到...

#include
using namespace std;
int main()
{
int t[12]={0,2,0,2,2,3,3,3,3,3,0,0};
int c[12]={79,60,79,48,60,53,47,60,53,74,39,60};
int sum;
float average;
sum =t[i]*c[i];
average=(float)sum/21;
printf("總分: %d\n", sum);
printf("平均: %5.2f\n", average);
system("PAUSE");
return 0;
}

B9633126 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[9]={84,77,60,77,84,80,80,76,79};
    int c[9]={1,1,3,3,0,2,2,3,3};
    int cc=18;
    int sum=0;
   
    float average;
   
    for (int i=0;i<9;i++)  
    {
         sum+=t[i]*c[i];
 
    }
    average=(float)sum/cc;
    cout<<average;
 
    system("Pause");
    return 0;
}   

B9633133 提到...

#include <iostream>
using namespace std;
int main()
{
 int sum=0, t[9]={88,78,70,77,89,85,80,86,81};
 int c[9]={1,1,3,3,0,2,2,3,3,};
 int cc=18;
 float average;
 
 
 for (int i=0;i<9;i++)
 {
    
   sum+=t[i]*c[i];   
 }    
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;

B9833176 提到...

#include <iostream>
using namespace std;
int main ()
{
int t[12]={60,60,85,48,64,70,39,41,51,62,65,71};
int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21;
int sum=0;
float average;
for (int i=0;i<12;i++)
{
sum+=t[i]*c[i];
}
cout<<sum<<endl;
average=(float)sum/21;
cout<<average;
system("pause");
return 0;
}

b9833155 提到...

#include <iostream>
using namespace std;
int main()
{
const int n=12;
int t[n]={79,61,80,60,60,76,69,69,79,74,65,77};
int c[n]={0,2,0,2,2,3,3,3,3,3,0,0};
int sum=0,cc=0,bb=0;
float average;
float average2;
for(int i=0;i<n;i++)
{
bb+=t[i]*c[i];
sum+=t[i];
cc+=c[i];
}
average=(float)sum/n;
average2=(float)bb/cc;
cout<<"總分:"<<sum<<endl;
cout<<"平均:"<<average<<endl;
cout<<"總學分:"<<cc<<endl;
cout<<"加權總分:"<<bb<<endl;
cout<<"加權平均:"<<average2<<endl;
system ("pause");
return 0;
}

b9533031 提到...

#include <iostream>
using namespace std;
int main()
{
    const int n=9;
    int t[9]={65,77,63,73,62,66,82,43,65};
    int c[9]={3,3,3,3,3,2,2,3,3};
    int cc=25;
    int sum=0;
    float average;
   
    for (int i=0; i<9; i++)
    {
    sum+=t[i]*c[i];
    }
   
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
       
    system("Pause");
    return 0;
}

b9533053 提到...

#include <iostream>
using namespace std;
int main()
{
    const int n=9;
    int t[9]={74,76,63,82,77,69,87,88,60};
    int c[9]={3,3,3,2,2,2,3,3,3};
    int cc=24;
    int sum=0;
    float average;
   
    for(int i=0; i<9; i++)
    {
{
            sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

B9833160 提到...

#include<iostream>
using namespace std;
int main()
{
const int n=12;
int t[n]={71,70,83,60,70,70,51,41,66,60,78,73};
int c[n]={0,2,0,2,2,3,3,3,3,3,0,0};
int sum=0,cc=0,bb=0;
float average;
float average2;
for(int i=0;i<n;i++)
{
bb+=t[i]*c[i];   
sum+=t[i];
cc+=c[i];
}
average=(float)sum/n;
average2=(float)bb/cc;
cout<<"總分"<<sum<<endl;
cout<<"平均"<<average<<endl;
cout<<"總學分"<<cc<<endl;
cout<<"加權總分"<<bb<<endl;
cout<<"加權平均"<<cc<<endl;
system("pause");
return 0;
}

b9833145 提到...

#include<iostream>
using namespace std;
int main()
{
const int n=12;
int t[n]={87,60,80,61,64,72,60,63,61,64,85,80};
int c[n]={0,2,0,2,2,3,3,3,3,3,0,0,};
int sum=0;
int cc=0;
int bb=0;
float average;
float average2;
for(int i=0;i<n;i++)
{
bb+=t[i]*c[i];
sum+=t[i];
cc+=c[i];
}
average=(float)sum/n;
average2=(float)bb/cc;
cout<<"總分"<<sum<<endl;
cout<<"平均"<<average<<endl;
cout<<"總學分"<<cc<<endl;
cout<<"加權總分"<<bb<<endl;
cout<<"加權平均"<<average2<<endl;
system("pause");
return 0;
}

B9833173 提到...

#include <iostream>
using namespace std;
int main ()
{
    int t[12]={75,65,83,66,68,70,50,53,56,60,80,69};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
        for (int i=0;i<12;i++)
    {
        sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average=(float)sum/cc;
    cout<<average;
        system("Pause");
    return 0;
}   

b9833132 提到...

#include <iostream>
using namespace std;
int main()
{
const int n=12 ;
int t[n]= {79,72,81,43,80,97,79,72,78,81,82,80};
int c[n]= {0,2,0,2,2,3,3,3,3,3,0,0};
int cc=21, sum=0;
float average;
for (int i=0;i<n;i++)
{
sum+=t[i]*c[i];
}
cout<<sum<< "\n";
average =(float)sum/cc;
cout<<average<<endl;
system("pause");
return 0 ;
}

B9833139 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={82,65,85,66,82,98,82,84,86,76,90,73};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12; i++)
    {
    sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average= (float)sum/cc;
    cout<<average;
   
    system("pause");
    return 0 ;
}

B9833162 提到...

#include <iostream> using namespace std; int main() {     const int n=12;     int t[12]={87,66,80,60,61,60,70,60,62,85,76,81};     int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};     int cc=21;     int sum=0;     float average;     for(int i=0; i<12; i++)         {         sum+=t[i]*c[i];         }        cout<<sum<<endl;     average=(float)sum/cc;     cout<<average<<endl;       system("pause");     return 0; }

B9833139 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[12]={82,65,85,66,82,98,82,84,86,76,90,73};
    int c[12]={0,2,0,2,2,3,3,3,3,3,0,0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12; i++)
    {
    sum+=t[i]*c[i];
    }
    cout<<sum<<endl;
    average= (float)sum/cc;
    cout<<average;
   
    system("pause");
    return 0 ;
}

B9833157 提到...

#include <iostream>
using namespace std;
int main()
{
    const int n=12;
    int t[12]={87, 80, 89, 80, 81, 90, 77, 92, 76, 88, 91, 80};
    int c[12]={0, 2, 0, 2, 2, 3, 3, 3, 3, 3, 0, 0};
    int cc=21;
    int sum=0;
    float average;
   
    for (int i=0; i<12; i++)
    {
        sum+=t[i]*c[i];  
    }
    cout<<sum<<endl;
    average=(float)sum/12;
    cout<<average;
    system("pause");
    return 0;
}

b9633122 提到...

#include <iostream>
using namespace std;
int main()
{
    int t[9]={84,85,63,68,72,88,85,99,96};
    int c[9]={1,1,3,3,0,3,3,3,3};
    int cc=20;
    int sum=0;
    float average;
   
    for (int i=0;i<9;i++)
        sum+=t[i]*c[i];
    cout<<sum<<"\n";
    average=(float)sum/cc;
    cout<<average;
    system("Pause");
    return 0;
}

Related Posts Plugin for WordPress, Blogger...

熱門文章