OOP Lab Q5.txt - #include <iostream>#include<string>\/using namespace std\/class candidate\/public string name int vote\/void outputElection(candidate arr

OOP Lab Q5.txt - #include <iostream>#include<string>/using...

This preview shows page 1 - 2 out of 2 pages.

//#include <iostream> //#include<string> //using namespace std; // //class candidate{ //public: // string name; // int vote; //}; // //void outputElection(candidate* arr){ // int total_vote = 0; // for (int i = 0; i<5; i++){ // //finding total no of votes // total_vote = total_vote + arr[i].vote; // } // // cout << "result of the election ............. " << endl; // cout << "name of candidate" << "\t" << "vote received" << "\t" << "percentage" << endl; // for (int i = 0; i<5; i++){ // cout << arr[i].name << "\t\t\t"; // cout << arr[i].vote << "\t\t"; // cout << (arr[i].vote * 100) / total_vote << "%" << endl; // } // // int max = INT_MIN, count = 0; // int index[5] = { 0 }; // // for (int i = 0; i<5; i++){ // if (arr[i].vote>max){ // max = arr[i].vote; // } // } // // for (int i = 0; i<5; i++){ // if (arr[i].vote == max){
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Fall '18
  • Zia Ul Rehman
  • Carriage return, int total, votes, int vote

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture