0
What's the wrong... This code c++ for arrays determine average of degrees for 150 student!!!?????
#include<iostream> using namespace std; int main( ) int student [150],sum=0,n; cin>>n; for (int i=1;i<=n;i++;) { for(int k=0;k<=149;k++) { cin>>student[k]; sum+=student[k]; } } cout<<"the average="<<(flout)sum/7; if(sum>average) cout<<"pass"; else cout<<"fail";
2 Antworten
+ 2
Off just glancing at it, i can see you typecast "flout" instead of "float" when you print the average.