Write a C++ program that reads a sequence of integer numbers from the input file data.txt. The sequence ends with a sentinel value of zero. The program should output the following into an output file results.txt:
Use the following values in the file data.txt to test your program:
5
4
-8
-7
6
-2
9
Write a C++ program that prompts the user to enter an even integer N which represents how many numbers he/she wants to enter. The program then reads N decimal numbers and finds the minimum number in the first half and the maximum number in the second half.
Complete the declaration and initialization of the array variable with datatype character, char array[ ]=???;. Initialized the first index with A, the second index with T, the third index E, the fourth index N, the fifth index as E, and the sixth index as O.
Your answer's format should be a complete declaration at the same time initialization:
format: datatype array_name[ ]=???;
Answer:
1. Create a menu to execute tasks. There shall be n tasks in total, update as they comes up. You should properly prompt wherever necessary.
Let us assume the program below runs smoothly, identify all function arguments in each function call in exact order and separate each argument in just a comma:
int getCube(int number){ return number * number * number;}
char getLetter(double n) {if(n>50) {return'0';} return 'X'}
double getThis(int num){return 1.0;}
int main(){
int n1 = 10, n2 = 123;
double vall = 123.45, val2 = 456.234;
cout << getCube(10) << " " << getCube(123) << "\n";
cout << getLetter(val2) << "-" << getLetter(val1);
cout << getLetter(34.23) << "--" << getThis(88);
cout << getThis(val1);
return 0;
}
What is the Answer? :
Let us assume the program below runs smoothly, identify all function arguments in each function call in exact order and separate each argument in just a comma:
int getCube(int number){ return number * number * number;}
char getLetter(double n) {if(n>50) {return'0';} return 'X'}
double getThis(int num){return 1.0;}
int main(){
int n1 = 78, n2 = 55;
double vall = 123.56, val2 = 784.59;
cout << getLetter(val1) << "-" << getLetter(val1);
cout << getLetter(val2) << "--" << getThis(val2);
cout << getCube(123) " " << getCube(321) << "\n";
cout << getThis(val1);
return 0;
}
What is Answer:
1. Write C++ statements that prompt the user to enter a person’s last name and then store the last name into the variable name.
1. Create a new project with following particulars
1. name the project title in the following format “ID_section_lab#” e.g., “f2019065111_w1_lab2”.
2. Create a menu to execute tasks. There shall be n tasks in total, update as they comes up. You should properly prompt wherever necessary. A sample menu is shown below.
1. Write a program that prompts the capacity, in gallons, of an automobile fuel tank and the miles per gallon the automobile can be driven. The program outputs the number of miles the automobile can be driven without refueling.