Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char name[50], highestName[50], lowestName[50];
- double mark, average, totalMark = 0;
- int i, totalStudent, highest = 0, lowest = 100, passingMark = 25, failStudent = 0;
- for( i = 1; i > 0 ; i++ ){
- cout << "Enter student's name : " ;
- cin >> name;
- cout << "Enter student's mark : " ;
- cin >> mark;
- totalMark = totalMark + mark;
- totalStudent = i;
- if(mark < 0){
- break;
- }
- if(mark < 25){
- failStudent++;
- }
- if(mark < lowest){
- lowest = mark;
- strcpy(lowestName, name);
- }
- if(mark > highest){
- highest = mark;
- strcpy(highestName, name);
- }
- }
- average = totalMark / totalStudent;
- cout << "\nThe average mark is : " << average << endl;
- cout << "\The student with highest mark is " << highestName << " with " << highest << " mark"<< endl;
- cout << "\The student with lowest mark is " << lowestName << " with " << lowest << " mark"<< endl;
- cout << failStudent << " student have failed this test" << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment