write a program which reads some number of interger values (up to 1000) fromthe
ID: 3656205 • Letter: W
Question
write a program which reads some number of interger values (up to 1000) fromthe file "numbers_inp.text". the file is arranged one number per line, and the first line contains the number of values. the program sholud determine the biggest and smallest values, as well as the average of the values (not including the first number in the file). the program should then output these three values to the file "number-out.text". Note: the program does not get any input from the keyboard and does not output anything to the screenExplanation / Answer
/*Friend!! i prefer you to use small file name instead of big. If you face any type of problem then use small file name. you may also download the code from...http://www.2shared.com/file/cK88Xp47/FILESUM.html */ #include#include#include#include void main() { int first,length; int max,min,value,sum; int count=1; char textValue[7]; float avg; clrscr(); ofstream fout; ifstream fin; fin.open("numbers_inp.text",ios::in); fin>>textValue; length=atoi(textValue); fin>>textValue; first=atoi(textValue); max=first; min=first; sum=first; while(!fin.eof()) { fin>>textValue; value=atoi(textValue); sum=sum+value; if(value>max) max=value; if(valueRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.