hey every one
please can u help me .. i need this today
Write a C++ program to read numbers end with -1 then print the largest number
i'm tring but always print to me the largest -1 that's wrong! :"(
how can i fix this
#include <iostream>
int main()
{
int number;
int count;
int largest;
count = 0;
while ( number != -1)
{
std::cout << "Enter the number: ";
std::cin >> number;
largest = number;
if ( number > largest && number!= -1 );
largest = number;
count = count + 1;
}
std::cout << "The largest number is : " << largest << std::endl;
return 0;
}
i wanna out put to be show like this .. i input n numbers and read the largest
Enter the number: 3
Enter the number: 5
Enter the number: 8
Enter the number: -1
The largest number is 8
please help meeee
..