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!

Recommended Answers

All 4 Replies

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?

commented: rule followers are good :) +1

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.

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?

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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.