This sounds like a homework assignment of the easiest kind, I'll answer in abstract details.
Create an array of integral types(or std::vector if unsure of the size at compile-time) the size of the number of numbers to hold.
Create a integral type variable that's initialized to the lowest possible value. We'll call this value "temp".
Fill the array with the data that you need.
Iterate through the array. For each element, compare it to "temp".
If "temp" is lower than the element of the array, assign temp that specific element of the array.
#include <iostream>
usingnamespace std;
int main()
{
int x=0;
int y=0;
for(int i=0;i<100;i++)
{
cin >> x;
if(x>y)
y=x;
cout << "The biggest number is: " << y << endl;
}
return 0;
}
Little point in printing 100 times what the current highest number is.
Also, it's best not to provide example code in topics like this. Clearly, he's too lazy to make his own homework. Programming assignments don't get any easier than this, thus if he can't manage, it should be clear as soon as possible.
Thanks Chrisscpp, Mathhead200 n to all of you to reply...
Gaminic First of all I'm new n had no idea about the quick replies here. I posted this question last night now I've got a chance to check is someone replied or not?? n happy to see such active ppl here.
I'm quite new in this world n started learning C++ from few days back..how can i write n share my codes here???
In all fairness, "I'm quite new n [sic] started learning C++" doesn't come over well when you apparently did no effort to solve the problem yourself. Next time, post your code so-far (in code tags, check the "format" table when posting) and specify what's wrong. We'll gladly give you some pointers to help you.
Also, I hope for your sake chipp doesn't read this topic.
m really surprised to see ua attitude with new comers.
N.e ways I tried to solve it by myself as well but I was hesitating to share my codes because here ppl're much expert ..I was thinking mine were wrong so called u ppl for help..
Don't worry, we don't judge. Well, I do, but not based on code.
We (the people who log on to this forum in our spare time and answer questions to the best of our ability) are here to help you learn, not to provide the answer to your assignment. We want to see your mistakes, so we can tell you what you did wrong and explain why it doesn't work, so you don't make the same mistake again.
We get enough bastards in here who simply want us to do their homework (and then often edit away the question...), so forgive us (well, just me, apparently) about getting cranky when seeing topics like this.