Question

In: Computer Science

Create a C++ program that will ask the user for how many test scores will be...

Create a C++ program that will ask the user for how many test scores will be entered.

Setup a while loop with this loop iteration parameter. (no fstream)

The data needs to include the student’s first name, student number test score

the fields should be displayed with a total width of 15.

The prompt should be printed with a header in the file explaining what each is:

ex.

First Name student number Test Score

1) mike 6456464   98

2) phill 3453453. 85

Solutions

Expert Solution

Program:

#include<iostream>
#include<string>
#include<iomanip>
using namespace std;

int main()
{
int numStudents;
//accepting the number of students test score count
cout<<"How many test scores do you want to enter: ";
cin>>numStudents;
  
//creating an array for each field
string name[numStudents];
long sno[numStudents];
int testScore[numStudents];
  
int i=0;
//accepting the values of the students from user
cout<<"\nEnter "<<numStudents<<" students name,number and test score: \n";
while(i<numStudents)
{
cout<<"\nEnter the name of student"<<(i+1)<<": ";
cin>>name[i];
cout<<"Enter the number of student"<<(i+1)<<": ";
cin>>sno[i];
cout<<"Enter the test score of student"<<(i+1)<<": ";
cin>>testScore[i];
i++;
}
  
i=0;
cout<<endl<<endl;
//Displaying the firstname, number and test score of each student
cout<<setw(15)<<"First Name"<<setw(15)<<"Student Number"<<setw(15)<<"Test Score"<<endl;
cout<<"-------------------------------------------------------------------"<<endl;
while(i<numStudents)
{
cout<<(i+1)<<")"<<setw(7)<<name[i]<<setw(15)<<sno[i]<<setw(15)<<testScore[i]<<endl;
  
i++;
}
return 0;
}

Output:


Related Solutions

Q1) Please create a C++ program that will ask the user for how many test scores...
Q1) Please create a C++ program that will ask the user for how many test scores will be entered. Setup a while loop with this loop iteration parameter. The data will include the student’s first name, Wayne State Access ID, midterm score and their favorite team (i.e. – Doug, hg1702, 92, Wolverines * - John, hv2201, 99, Warriors). Print out the completed test scores to a file (midTermScores.txt) . Adjust the output as follows: (15 points) a. Scores with the...
C++ program that will ask the user for how many test scores will be entered. Setup...
C++ program that will ask the user for how many test scores will be entered. Setup a while loop with this loop iteration parameter. The data will include the student’s first name and midterm score Print out the completed test scores to a file (midTermScores.txt) . Print out list of students names and grades in the print out, a letter grade should replace numeric score using standard grading (a = 90 – 100, b=80-90, c=70-80, d=60-70, f=below 60)
C LANGUAGE Ask user how many scores there are, then ask for each score. Then calculate...
C LANGUAGE Ask user how many scores there are, then ask for each score. Then calculate the average score and scores below 60. Then display the average score and number of scores below 60
Write a program in Java to: Ask the user how many scores they want to enter...
Write a program in Java to: Ask the user how many scores they want to enter (=> Create an array based the entered size) Ask the user to enter their scores in the quarter (Fill the array with the entered scores(assigned to elements)) ==>> Use a "for" loop Find the greatest score Calculate and show the average Show the final grade based on the average (For example A,B,C ... ) Print the scores (the elements of the array) => Use...
Write a program using C++ that ask the user for the flowing: How many shares to...
Write a program using C++ that ask the user for the flowing: How many shares to be bought: The price per share: Percent commission for the broker for each transaction: Average annual return as of percentage: The program should calculate and display the following: The amount paid for the stock alone (without the commission) The amount of the commissionThe total amount of paid (the payment for stock plus the commission) After TEN years, your shares will worth:
You have been asked to create a python program that will ask the user how many...
You have been asked to create a python program that will ask the user how many tickets the user would like to purchase for graduation. The user will then choose the number of tickets needed and the program will list the cost of the tickets, a service fee, tax, and the total of the purchase. Specifications: The program should only accept whole numbers when receiving input for the number of tickets needed. No calculations should be performed if input is...
Create a program (Python) YourFirstnameLastnameA06b.py to ask the user to create a password: The user will...
Create a program (Python) YourFirstnameLastnameA06b.py to ask the user to create a password: The user will first enter a password, then enters the same password again; If the second input is the same as first one, the user successfully creates the password. Print “Well done.”; Otherwise, the user will be directed to repeat the whole process (go to step 1.)
write a program in c++ that asks the user to enter their 5 test scores and...
write a program in c++ that asks the user to enter their 5 test scores and calculates the most appropriate mean. Have the results print to a text file and expected results to print to screen.
Python Program Write a program that will ask a user on how many input colored balls...
Python Program Write a program that will ask a user on how many input colored balls of the following codes: R-red, B-blue, W-white, G-green and O-orange -will he or she would like to enter in the program and print the total number of Red balls were encountered. Assume an uppercase and lower case letter will be accepted.
Using (C programming language) Create a health monitoring program, that will ask user for their name,...
Using (C programming language) Create a health monitoring program, that will ask user for their name, age, gender, weight, height and other health related questions like blood pressure and etc. Based on the provided information, program will tell user BMI, blood pressure numbers if they fall in healthy range or not and etc. Suggestions can be made as what should be calorie intake per day and the amount of exercise based on user input data. User should be able to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT