1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

aoa

Discussion in 'C++' started by sadia.a, Nov 2, 2010.

  1. sadia.a

    sadia.a New Member

    Joined:
    Nov 2, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    anyone who help me in making this programme the programme is as plzzzzzzzzzzzz help


    Problem Statement: Calculating No. of A Grades in Class

    You are required to write a program which should take input from user in the form of characters A or B. Based upon user’s input you should calculate no. of A grades. You should use while loop or do/while loop for taking input and if / else condition for making decisions.




    Detailed Description:

    The program should display like;

    Please Enter Grade (‘A’ OR ‘B’ )

    Then the program should take 10 inputs one by one,

    • After taking 10 inputs, you should display no. of A grades.
    • If A grades are less than or equal to 2, you should display a message “Your class is Poor!â€.
    • If A grades are less than or equal to 7, you should display a message “Your class is Good!â€.
    • If A grades are greater than or equal to 8, you should display a message “Your class is Brilliant!â€.
    • The user should enter either A or B. If user has entered other than A or B, e.g. C,D,E etc. Your program should display a message like;
    "Please Enter 'A' or 'B' grade only!"

    Sample Input and Output

    Please Enter Grade of student 1 :
    A
    Please Enter Grade of student 2 :
    A
    Please Enter Grade of student 3 :
    B
    Please Enter Grade of student 4 :
    A
    Please Enter Grade of student 5 :
    B
    Please Enter Grade of student 6 :
    B
    Please Enter Grade of student 7 :
    A
    Please Enter Grade of student 8 :
    B
    Please Enter Grade of student 9 :
    C

    Please Enter ‘A’ or ‘B’ grade only!
    Please Enter Grade of student 9 :
    A

    Please Enter Grade of student 10 :
    A



    Total No. of A Grades = 6

    Your Class is Good!
     
  2. go4expert

    go4expert Moderator

    Joined:
    Aug 3, 2004
    Messages:
    306
    Likes Received:
    9
    Trophy Points:
    0
    Admin please move this topic out of introduction forum
     
  3. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    Moved and thanks for using the report button as well as posting.
     
  4. go4expert

    go4expert Moderator

    Joined:
    Aug 3, 2004
    Messages:
    306
    Likes Received:
    9
    Trophy Points:
    0
    The pleasure is all mine.
     
  5. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    19
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    Man your class is very bad...u not even tried to do it...anywayz I am here to help the people like you..so i m not bothered now whether u people understand the language or not...giving u the code..i hope it will help u:-
    Code:
    
    # include<stdio.h>
    # include<conio.h>
    
    void main()
    {
    char grades[10];
    int i;
    int count=0;
    for(i=0;i<10;i++)
    {
    printf("Please Enter Grade of student %d: \n",i+1);
    scanf("%c",&grades[i]);
    while(grades[i]!='A' || grades[i]!='B')
    {
    printf("Please Enter ‘A’ or ‘B’ grade only!");
    scanf("%c",&grades[i]);
    }
    }
    
    for(i=0;i<10;i++)
    {
    if(grades[i]=='A')
    count++;
    }
    
    if(count<=2)
    printf("Your class is Poor!");
    if(count>2 && count<=7)
    printf(“Your class is Good!â€);
    if(count=8)
    printf("Your class is Brilliant!");
    
    getch();
    }
    
     

Share This Page