Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.


Solution::



#include <iostream>


 


using namespace std;


 


voidmain()


{


            char grade;        //char for storing individual grade;


            int i=1; //counter for while loop


            int Acounter=0; //counter for A grade


           


            while (i<=10)


            {


 


startwhile:


 


                        cout"Please Enter Grade of student "i" :"endl;


                        cin>>grade;


 


                        if (grade=='A')


                        {


                                    Acounter=Acounter+1;


                        }


 


                        else if (grade!='B')


                        {


                                    coutendl"Please Enter 'A' or 'B' grade only!"endlendl;


                                    goto startwhile;


                        }


                        i=i+1;


            }


 


            coutendlendl"Total No. of A Grades: "Acounterendl;


 


            if (Acounter<=2)


            {


                        cout"Your class is Poor!";


            }


 


            else if (Acounter<=7)


            {


                        cout"Your class is Good!";


            }


 


            else if (Acounter<=8)


            {


                        cout"Your class is Brilliant!";


            }


            coutendlendl;


} //bye bye


Views: 606

Replies to This Discussion

AASSignment 201 Programming start discussion
Attachments:
Need idea ........?

This assignment needs to be done using functions as specified in the question. This could have been improvised by calling a function twice to fill up both arrays instead of using two for loops. Secondly the program should have covered three scenarios for the matching, 1. if 10 of the elements are identical, give the message, 2. if all 10 elements are different, give the relevant message, AND 3. IF SOME ELEMENTS ARE IDENTICAL THAN INDICATE WHICH ONES

so for the ones copying this program BEWARE
Plz upload solution. and tell me do i need to upload C++ programe file or simply write programe in MS-word file and upload it?
#include

using namespace std;

void main()
{
char grade; //char for storing individual grade;
int i=1; //counter for while loop
int Acounter=0; //counter for A grade

while (i<=10)
{

startwhile:

cout"Please Enter Grade of student "i" :"endl;
cin>>grade;

if (grade=='A')
{
Acounter=Acounter+1;
}

else if (grade!='B')
{
coutendl"Please Enter 'A' or 'B' grade only!"endlendl;
goto startwhile;
}
i=i+1;
}

coutendlendl"Total No. of A Grades: "Acounterendl;

if (Acounter<=2)
{
cout"Your class is Poor!";
}

else if (Acounter<=7)
{
cout"Your class is Good!";
}

else if (Acounter<=8)
{
cout"Your class is Brilliant!";
}
coutendlendl;
} //bye bye
Attachments:
Need solution for 2nd assignment
dear brothers and sisters

Mani has come again with the solution of cs201 assignment 2. get idea from here and make your own.
Attachments:
Good try, but again this could have been made more elegant by calling a function twice for filling up both arrays. Secondly as a good programming practice, the called function "match" should only compare and give result to the calling function, and the decision upon the result should have been made by that calling function. This would have made the function "match" more generic. Also instead of using constant values of 10, at every place, a constant variable of value 10 would have made the program more flexible.
can u plz make it more elegant by calling a function twice for filling up both arrays?
I won't write the complete code but I will give you the following hint.

#include<...>
.
.
void fillUpArray(int const*);
const int MAX = 10;
.
.
.
int main(){
int array1[MAX] = {0}, array2[MAX] = {0};
.
.
fillUpArray(array1);
fillUpArray(array2);
.
.
.
}
plz upload the solution of assignment 02

RSS

© 2021   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service