In: Computer Science
11. For each of the following problems, click after Statement, press enter and type a statement to accept input data from the keyboard into meaningful variable names of your choice. Your statement includes prompts and conversion functions as needed. a. Accepts your gpa (a real number). Statement: b. Accepts the number of people in your family (an integer number). Statement:
In this question because programming language is not specify, so that i am writing given statement in C and C++ programming language:
______________________________________________________________________________________
Statement 1: Accept your gpa:
Because in given statement gpa is a real number, so here i am declaring this variable as a float dat atype.
In C Language:
Statement:
float gpa;//variable declaration of float type
printf("Enter your gpa====");// This statement display a message to the user at the run time
scanf("%f",&gpa);// value enter by user is stored in this variable.
printf("GPA value entered by you====%f",gpa);//Display a message on the screen
In C++ Language:
Statement:
float gpa; //variable declaration of float type
cout<<"Enter your gpa";//This statement display a message to the user at the run time
cin>>gpa;//value enter by user is stored in this variable.
cout<<"GPA value entered by you===";//Display a message on the screen
________________________________________________________________________________________________________
Statement 2:Accepts the number of people in your family (an integer number):
In C Language:
Statement:
int NoOfFamilyMember; // variable declaration of integer type
printf("Enter total numbers of members in your family"); //on a output screen display a message to the user
scanf("%d",&NoOfFamilyMember); //store the value input by user in the variable
printf("Totla number of family members entered by you===%d",NoOfFamilyMember);
In C++ Language:
Statement:
int NoOfFamilyMember; // variable declaration of integer type
cout<<"Enter total numbers of members in your family"; //on a output screen display a message to the user
cin>>NoOfFamilyMember//store the value input by user in the variable
cout<<"Totla number of family members entered by you===";