Computers and Technology
Computers and Technology, 25.03.2020 06:29, sarahidan

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;
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:00, taylorsamodell3217
Who is the first president to use social media as part of his campaign strategy
Answers: 1
image
Computers and Technology, 22.06.2019 17:50, ImBADatmath8743
Farah works in an office with two other employees. all three share a printer and an internet connection. the utility that makes this possible is defragger quicktime soho winzip
Answers: 1
image
Computers and Technology, 24.06.2019 13:00, sparkyjones02
Which best describes the condition under which the unicode output is the same as plain text ?
Answers: 1
image
Computers and Technology, 24.06.2019 16:30, saadshami2384
You may see the term faq on websites which stands for frequently asked questions this is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation ken has dipped many dark chocolate marshmallows (which you remember the metric system distance units in decreasing order: kilometers, hectometer, decameter, centimeter, millimeter) is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation !
Answers: 1
Do you know the correct answer?
Exercise 1: Write a short program called readata. cpp that defines a character array last which cont...

Questions in other subjects:

Konu
Social Studies, 05.12.2019 22:31