0

Hi fellow forumers...I am new to this forum and programming.
Regarding the above topic..Is there and code that solves this sort of question?

My question:A program that input 10 integers and find the largest value.

Thanks very much!

3
Contributors
4
Replies
9
Views
7 Years
Discussion Span
Last Post by Fbody
1

Hello.
I'm new here, too, but I have read the site rules. You're supposed to show an effort before the site's members will help you.

But the answer to your question is yes, there is code to solve that problem.

I'd get user input, put their numbers into an array and then check each number in the array. Or you could use a vector, I guess.

What code have you written so far?

Edited by MyrtleTurtle: n/a

Votes + Comments
rule followers are good :)
0

Depending on the rest of the requirements for the assignment, it can actually be done more simply than that.

I'm going to let the OP stew on it for a little while though.

0

Hello.
I'm new here, too, but I have read the site rules. You're supposed to show an effort before the site's members will help you.

But the answer to your question is yes, there is code to solve that problem.

I'd get user input, put their numbers into an array and then check each number in the array. Or you could use a vector, I guess.

What code have you written so far?

I see...Really sorry if I have neglected the rules..
This was ask by my lecturer and I couldnt solve it after sitting there for hours..And she told me, Its a code that I havent teach yet...

here's the part that I managed to work out:

#include <iostream>
using namespace std;
int main()

{
    int x,number;
    for (x=1,x<=10,x++)
    { 
       cout<<" Please enter a value."<<endl;
       cin>>number;

I did till this part. Then I think I need to input some sort of code using if else code? or the so called max code by my lecturer....?

fybody: whats OP?

Edited by WaltP: for being sorry you neglected the rules, maybe you should have actually READ them!

0

fybody: whats OP?

OP = Original Post/Poster

Regarding your code:
1. please use [code=syntax]...code tags... [/code] they make your code easier to read. Read this.
2. what you do next is determine what value is HIGHER, the previous value or the current value. Surely you are familiar with relational operators (you'll have to scroll down a little).

Edited by Fbody: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.