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, 22.06.2019 12:20
Usually, when we sniff packets, we are only interested certain types of packets. we can do that by setting filters in sniffing. scapy’s filter use the bpf (berkeley packet filter) syntax; you can find the bpf manual from the internet. set the following filters and demonstrate your sniffer program again (each filter should be set separately): (a) capture only the icmp packet. (b) capture any tcp packet that comes from a particular ip and with a destination port number 23. (c) capture packets comes from or to go to a particular subnet. you can pick any subnet, such as 128.230.0.0/16; you should not pick the subnet that your vm is attached to.
Answers: 3
question
Computers and Technology, 22.06.2019 19:20
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_balance should be removed since header files should not contain constants.c)the definition of cashregister should be removed since header files should not contain class definitions.d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
Singing in the rain: this first part of the film shows the early history of motion picture. how accurate do you think the portrayal of the early motion picture industry is? why? is historical accuracy important in films and theater productions? explain.
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
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.08.2020 01:01
Questions on the website: 13722363