How to write numbers in Japanese over 20?

Write a C++ program to read 20 numbers from user and place them in a one dimensional array. The program should?

  • Write a C++ program to read 20 numbers from user and place them in a one dimensional array. The program should then read from the array and calculate the maximum value the minimum ...show more

  • Answer:

    This is your code: //prompt for error if (infile.fail()) cerr << "Error opening input file.\n "; exit(1); // make it: //prompt for error if (infile.fail()) { cerr << "Error opening input file.\n "; exit(1); } In your code the cerr statement was reached conditionally., while the exit(1) statement was reached unconditionally. exit(1) is always executing!!!!

UNONL6D5H5GNTBSY7IJMJNDXU4 at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

you were working too hard... specs called to read from user not a file.... #include <iostream> #include <iomanip> #include <fstream> using namespace std; int main() { double sum,av,smallest,largest; double nums[20]; int count; cout << "enter numbers:"; cin >> nums[0]; sum=smallest=largest=nums[0];// set largest smallest and sum to first element. for(count=1;count<20;count++){ cin >> nums[count]; sum+=nums[count]; if (nums[count]> largest) largest=nums[count]; if(nums[count]<smallest) smallest=nums[count]; } cout << "sum = " << sum << endl; cout << "largest value = " << largest << endl; cout << "smallest value = " << smallest << endl; cout << "Average = " << sum/20. << endl; system("pause"); return 0; }

roger

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.