Answer:
/*C++ program that prompts user to enter the name of input file(input.txt in this example) and print the sum of the values in the file to console. If file dosnot exist, then close the program */
//header files
#include <fstream>
#include<string>
#include <iostream>
#include <cstdlib> //needed for exit function
using namespace std;
//function prototype
int fileSum(string filename);
int main()
{
string filename;
cout << "Enter the name of the input file: ";
cin >> filename;
cout << "Sum: " << fileSum(filename) << endl;
system("pause");
return 0;
}
/*The function fileSum that takes the string filename and
count the sum of the values and returns the sum of the values*/
int fileSum(string filename)
{
//Create a ifstream object
ifstream fin;
//Open a file
fin.open(filename);
//Initialize sum to zero
int sum=0;
//Check if file exist
if(!fin)
{
cout<<"File does not exist ."<<endl;
system("pause");
exit(1);
}
else
{
int value;
//read file until end of file exist
while(fin>>value)
{
sum+=value;
}
}
return sum;
}//end of the fileSum
Explanation:
This is a C++ program that prompts user to enter the name of input file(input.txt in this example) and print the sum of the values in the file to console. If file dosnot exist, then close the program.
Check attachment for sample output screenshot.
Answer:
processing
Explanation:
The flow chart is a diagram that shows the activity of the program, peoples or things.
Flowchart symbol and meaning in the options:
1. Processing: it is a rectangular shape block which is used for variable declaration or assignment.
2. I/0: it is a parallelogram in shape which is used for input or output.
3. Parallelogram: it is used for input or output.
4. diamond: it is used for decisions or conditions.
Therefore, the correct option is a. Processing is the one that is used for the assignment statement.
Answer:
a
Explanation:
hackers access your system unauthorized
Talking books could be a means to automatize and generalize such an audio–visual reading experience. ... RWL consists of an experimental reading situation where one reads a text while one can hear it said aloud by a prerecorded speaker or by a text-to-speech system.
Answer:
1. Wall clocks.
2. Analog watches
3. Measuring instruments with callibration
Explanation: