subject

Exercise 1: Write a short program called readata. cpp that defines a character array last which contains 10 characters. Prompt the user to enter their last name using no more than 9 characters. The program should then read the name into last and then output the name back to the screen with an appropriate message. Do not use the getline() or get functions!
Exercise 2: Once the program in Exercise 1 is complete, run the program and enter the name Newmanouskous at the prompt. What, if anything, happens? (Note that the results could vary depending on your system).
Exercise 3: Re-write the program above using the getline() function (and only allowing 9 characters to be input). As before, use the character array last consisting of 10 elements. Run your new program and enter Newmanouskous at the prompt. What is the output?
Exercise 4: Bring in program grades. cpp and grades. txt from the Lab 10 folder. Fill in the code in bold so that the data is properly read from grades. txt. and the desired output to the screen is as follows:

#include
#include
using namespace std;
// PLACE YOUR NAME HERE
const MAXNAME = 20;
int main()

{
ifstream inData;
inData. open("grades. txt");
char name[MAXNAME + 1]; // holds student name
float average; // holds student average
inData. get(name, MAXNAME+1);
while (inData)
{
inData >> average;
// FILL IN THE CODE to print out name and
// student average
// FILL IN THE CODE to complete the while
// loop so that the rest of the student
// names and average are read in properly
}
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 18:20
What is wi-fi infrastructure? a metropolitan area network that uses radio signals to transmit and receive data a communications technology aimed at providing high-speed wireless data over metropolitan area networks a means by which portable devices can connect wirelessly to a local area network, using access points that send and receive data via radio waves includes the inner workings of a wi-fi service or utility, including the signal transmitters, towers, or poles and additional equipment required to send out a wi-fi signal
Answers: 2
question
Computers and Technology, 23.06.2019 19:00
Acompany is hiring professionals for web designing. the firm is small with few resources. they want employees who possess problem-solving skills and can independently carry out responsibilities. which kind of employee should they select?
Answers: 2
question
Computers and Technology, 24.06.2019 16:50
Develop the program incrementally: a) start by reading and displaying each line of the input file to make sure you are reading the data set correctly. b) use the split string method to extract information from each line into a list. print the list to prove that this step is working correctly. d) convert the exam scores to type int and calculate the student’s average. display those items to prove this step is working correctly. e) create a tuple containing the six items for each student (name, exam scores, exam mean). display the tuples to prove this step is working correctly. (optionally, you may want to have the exam scores in a list so your tuple is (name, scores_list, f) append each tuple to a list. display the list to prove this step is working correctly. g) use the sort list method to re-order the tuples in the list. display the list to prove this step is working correctly. h) use a for statement to display the contents of the list as a table (with appropriate formatting). i) use a for statement to calculate the average of all scores on exam #1, then display the results. note that you could have calculated this average within the first loop, but we are explicitly requiring you to do this calculation by looping though your list of tuples. j) add the logic to calculate the average of all scores on exam #2, then display the results.
Answers: 2
question
Computers and Technology, 24.06.2019 17:40
Which of the following processes applications across multiple computing devices? a. functional application b. distributed system c. workgroup information silo d. information silo
Answers: 3
You know the right answer?
Exercise 1: Write a short program called readata. cpp that defines a character array last which cont...
Questions
question
Mathematics, 15.01.2021 17:30
question
Mathematics, 15.01.2021 17:30
question
Arts, 15.01.2021 17:30
question
English, 15.01.2021 17:30
question
English, 15.01.2021 17:30
Questions on the website: 13722363