Question

C++, create a code that looks at a connected string in the format (Name,age,Grade,highschoolname), and always...

C++, create a code that looks at a connected string in the format
(Name,age,Grade,highschoolname), and always finds and outputs the grade(A,A-,B,B+....)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

C++ Program for Obtain Grades

         #include <iostream>  

         using namespace std;  

        int main() {  

        string name,highscoolname;

      int age;  

cout << "Enter your name: ";

           cin >> name;   

cout << "Enter your age: ";  

           cin >> age;  

         cout << "Enter your highscool: ";

           cin >> highscoolname;   

               cout << "name is: " << name

               cout << "Your age is: " << age

  int marks[6] ={65,75,85,56,65,95}; int i; float total=0, avg;             for(i=0; i<6; i++) {  total = total + marks[i]; }  //Calculating average here avg = total/6;  cout<<"The student Grade is: "; if(avg>90) {  cout <<"Grade is A+ ";     } else if(avg>=80 && avg<90) {   cout << "Grade is A ";  } else if(avg>=70 && avg<80) { cout <<"Grade is B+ ";   } else if(avg>=60 && avg<70) { cout <<"Grade is B ";   }

           else if(avg>=50 && avg<60)

             {

                  cout <<"Grade is C+ ";  

             }

else if(avg>=40 && avg<50)

             {

                 cout <<"Grade is C ";  

             }

        else

             {

                  cout <<"Grade is D ";  

             }

           cout << "school is: " << highscoolname<< endl

   return 0;    

}

Output:

name is:yaswanth Your age is:26 Grade is B+ school is:noble school

  

Add a comment
Know the answer?
Add Answer to:
C++, create a code that looks at a connected string in the format (Name,age,Grade,highschoolname), and always...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  •    Create   a   C-string   variable   that   contains   a   name,   age,   and   title.   Each   field   is separat

       Create   a   C-string   variable   that   contains   a   name,   age,   and   title.   Each   field   is separated   by   a   space.   For   example,   the   string   might   contain   “Bob   45 Programmer”   or   any   other   name/age/title   in   the   same   format.   Assume   the name,   age,   and   title   have   no   spaces   themselves.   Write   a   program   using   only functions   from   cstring   (not   the   class   string)   that   can   extract   the   name, age,   and   title   into   separate   variables.   Test   your   program   with   a   variety   of names,   ages,   and   titles....

  • create a Person class with two fields (name(String), age(int)) create all the required methods such as...

    create a Person class with two fields (name(String), age(int)) create all the required methods such as the accessors, mutators, toString(),constructors etc. Use the comparable interface and implement the compareTo method such that the person objects can be compared and sorted according to their age.

  • c++ 1) String format checker A string is referred to as A"B"A" if it contains n...

    c++ 1) String format checker A string is referred to as A"B"A" if it contains n > 0 consecutive As followed by n consecutive Bs followed by n consecutive As. Your task is to accept an arbitrary string of any length 1 <k, and determine if it is of the form A"B"A" If it is, then the output of the program is be "Format is OK". Otherwise the output is "Format not acceptable." For example, The given the Linux prompt>...

  • python code? 1. Create a class called Person that has 4 attributes, the name, the age,...

    python code? 1. Create a class called Person that has 4 attributes, the name, the age, the weight and the height [5 points] 2. Write 3 methods for this class with the following specifications. a. A constructor for the class which initializes the attributes [2.5 points] b. Displays information about the Person (attributes) [2.5 points] c. Takes a parameter Xage and returns true if the age of the person is older than Xage, false otherwise [5 points] 3. Create another...

  • Here is the code for the Infant class: public class Infant{ private String name; private int...

    Here is the code for the Infant class: public class Infant{ private String name; private int age; // in months public Infant(String who, int months){ name = who; age = months; } public String getName(){ return name;} public int getAge(){ return age;} public void anotherMonth() {age = age + 1;} } The code box below includes a live Infant array variable, thoseKids. You cannot see its declaration or initialization. Your job is to find out which Infant in the array...

  • You will create a class to keep student's information: name, student ID, and grade. The program...

    You will create a class to keep student's information: name, student ID, and grade. The program will have the following functionality: - The record is persistent, that is, the whole registry should be saved on file upon exiting the program, and after any major change. - The program should provide the option to create a new entry with a student's name, ID, and grade. - There should be an option to lookup a student from his student ID (this will...

  • Create a console application project and solution called “ConsoleWorkWithData.” using C# Create the following variables with...

    Create a console application project and solution called “ConsoleWorkWithData.” using C# Create the following variables with data type: a. FirstName: string data type b. LastName: string data type c. Student ID: int data type d. BirthDate: data time data type e. Grade: decimal data type Write all values in these variables to the screen in this format: a. --------------------------------------------------------- b. My name is Rieser Angie c. I’m a new student, and this is my first program d. ************************************** e. My...

  • in C++: Create a class named Student that has three member variables: name - string that...

    in C++: Create a class named Student that has three member variables: name - string that stores the name of the student numClasses - integer that tracks how many courses the student is currently enrolled in, this number must be between 1 and 100. classList - an array of strings of size 100 used to store the names of the classes that the student is enrolled in Write the appropriate constructor(s), mutator and accessor functions for the class along with...

  • (a) Create a Huffman code for the following string (whitespace inserted for clarity): AAA BB CCCCC...

    (a) Create a Huffman code for the following string (whitespace inserted for clarity): AAA BB CCCCC CCCCC DD EEE (b) How many bits does your code use to encode the above string? (c) Huffman codes are always optimal prefix codes, and there are many different ways one can build a Huffman code from the same set of character frequencies (e.g. by swapping the left and right subtrees at any iteration). Give an example of an optimal prefix code for this...

  • Paste the R code for each exercise along with the answers. If: Age <- c(22, 25,...

    Paste the R code for each exercise along with the answers. If: Age <- c(22, 25, 18, 20) Name <- c("James", "Mathew", "Olivia", "Stella") Gender <- c("M", "M", "F", "F")       then what is the R-code for getting the following output: ##   Age   Name Gender ## 1 22 James      M ## 2 25 Mathew      M a. DataFrame = data.frame(c(Age), c(Name), c(Gender)) subset(DataFrame, Gender == "M") b. DataFrame = data.frame(c(Age),c(Name),c(Gender)) subset(Gender=="M"), eval=FALSE c. DataFrame = data.frame(Age,Name,Gender) subset(DataFrame,Gender=="M") d. DataFrame = data.frame(c(Age,Name,Gender))...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT