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 are the extraction and insertion operators in c++?
Explain the difference between c++ and java.
What is the this pointer?
What is a base class?
What is encapsulation in c++?
how to access grid view row?
Explain virtual class?
What are friend classes? What are advantages of using friend classes?
Write a Program to find the largest of 4 no using macros.
Please explain class & object in c++?
Describe the role of the c++ in the tradeoff of safety vs. Usability?
Explain the difference between overloading and overriding?
Explain the isa and hasa class relationships. How would you implement each?
What are the differences between the function prototype and the function defi-nition?
Do you know the problem with overriding functions?