68 327
Assignments Done
99%
Successfully Done
In November 2018

Answer to Question #27746 in C++ for david Woods

Question #27746
Use the while loop to aggregate students marksstored in an array. Use an enum to indicate in the array which student got which student got which mark and apply object oriented principles.
Expert's answer
# include <iostream>
# include <string>
using namespace std;


int main(){

enum mark{Fail, Pass, Exelent};

string s[20];

s[0]="e";
int m[20];
int i=0;
while (1){

cout<<"Enter name: ";
getline(cin, s[i], '\n');
if (s[i]=="") break;

cout<<"Enter mark : ";
cin>>m[i];
i++;
cin.ignore();
}

for (int j=0;j<i;j++){
for (int k=0;k<i-j-1;k++){
if ( m[k] > m[k+1] )
{
string temp = s[k];
s[k] = s[k+1];
s[k+1] = temp;

int tem = m[k];
m[k] = m[k+1];
m[k+1] = tem;
}
}

}
cout<<"sorted\n";

for (int j=0;j<i;j++){
cout<<s[j]<<" mark:"<<m[j]<<endl;
}


system("PAUSE");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
09.04.13, 19:06

You're welcome. We are glad to be helpful.
If you really liked our service please press like-button beside answer field. Thank you!

david
07.04.13, 10:59

Thank you very much. I really appreciate

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions