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, 24.06.2019 12:00
What is a sketch or blueprint of a web page that shows the structure (but not the detailed design) of basic page elements such as the logo, navigation, content, and footer?
Answers: 3
question
Computers and Technology, 24.06.2019 12:00
How can we take picture in this app
Answers: 1
question
Computers and Technology, 24.06.2019 16:50
Ramp charts are generally created in wordlotusexcelpowerpoint
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately
Answers: 2
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, 14.09.2020 06:01
question
Mathematics, 14.09.2020 06:01
question
Chemistry, 14.09.2020 06:01
question
Mathematics, 14.09.2020 07:01
question
English, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
question
Health, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
question
English, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
question
Health, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
question
History, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
question
Physics, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
question
Mathematics, 14.09.2020 07:01
Questions on the website: 13722362