Answer Posted / ahmed.aboelella
/**
As there is no need to save in array
Also we have to init max with first value to get max in case
user entered negative values
*/
#include "iostream"
using namespace std;
void main()
{
cout<<"Enter 10 numbers: ";
int i, temp, max;
//Enter first number to init max
cin>>max;
for(i = 0 ; i < 9; i ++)
{
cout<<"Enter Number: ";
cin>>temp;
max = temp > max ? temp : max;
}
cout<<"Max Number is "<<max<<endl;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is a pdb file?
What is meant by the term name mangling in c++?
Explain the difference between using macro and inline functions?
Explain queue. How it can be implemented?
What is the basic structure of a c++ program?
Is it possible to pass an object of the same class in place of object reference to the copy constructor?
Explain the advantages of using friend classes.
Differentiate between an array and a list?
Define the process of handling in case of destructor failure?
What does the following code do: int c=0; cout< a) Undefined *Updated* b) 01 c) 00
Which programming language is best?
Can we use this pointer inside static member function?
What is the importance of mutable keyword?
what is VOID?
What are the various storage classes in C++?