#include
Computers and Technology, 17.10.2020 20:01 whitneyt3218
Convert the following C program to C++.
More instructions follow the code.
#include
#include
#define SIZE 5
int main(int argc, char *argv[]) {
int numerator = 25;
int denominator = 10;
int i = 0;
/*
You can assume the files opened correctly and the
correct number of of command-line arguments were
entered.
*/
FILE * inPut = fopen(argv[1], "r");
FILE * outPut = fopen(argv[2], "w");
float result = (float)numerator/denominator;
fprintf(outPut,"Result is %.2f\n", result);
float arr[SIZE];
for( ; i < SIZE; i++) {
fscanf(inPut, "%f", &arr[i]);
fprintf(outPut, "%7.4f\n", arr[i]);
}
return 0;
}
Notice this is uses command-line arguments. I have provided an input file called num. txt that will be used when running the program. The output file is called out. txt.
Make sure you are using C++ style file I/O (FILE pointers/fopen) as well as regular I/O including the C++ style output formatting (fscanf, fprintf, formatting). Also use the C++ method of casting. The lines above that are bold are the lines that you need to convert to C++. Don't forget to add the necessary C++ statements that precede the main() function.
Answers: 2
Computers and Technology, 22.06.2019 01:30
What “old fashioned” features of checking accounts is p2p replacing
Answers: 3
Computers and Technology, 22.06.2019 18:30
Kto rozmawia z clamentain przez krótkofalówke w the walking dead która śledzi lee w 4 epizodzie
Answers: 1
Computers and Technology, 22.06.2019 23:30
Which of the following is not a symptom of chronic fatigue syndrome
Answers: 2
Computers and Technology, 24.06.2019 05:30
Someone plzz me which of these defines a social search? a. asking a search engine a question that is answered by a real person on the other sideb. modifying search results based on popularity of a web pagec.modifying search results based on a ranking of a web page
Answers: 2
Convert the following C program to C++.
More instructions follow the code.
#include
#include
History, 13.06.2020 09:57
Mathematics, 13.06.2020 09:57
Mathematics, 13.06.2020 09:57
Mathematics, 13.06.2020 09:57
Mathematics, 13.06.2020 09:57
Mathematics, 13.06.2020 09:57
Social Studies, 13.06.2020 09:57
Mathematics, 13.06.2020 09:57
Mathematics, 13.06.2020 09:57