Finding the largest of an unknown amount of numbers

I need help with this program. I need to find the largest of a group of files but I have got stuck. Help please

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <iostream>
#include<vector>

using namespace std;

//Declare variables
int GetInput()
{
int userinput;

        cout << "Please enter the the size of your file ";
        cin >> userinput;

        return userinput;
    }
//end function


/*
int GreatestInput()
{
    int Greatest;
    int j = 0;
//loop once for every input
    for(int j);
    j < Files.size() ;
    j++)
    {
        if (Files[j] > Greatest])
        {
            Greatest = Files[j]
        }//end if
    }//end for
    return Greatest;
}

*/
int main()
{
    bool stop = false;
    vector<int> filelist;
    string stopstring;
    int userinput;
    int greatest
while (stop == false)
 {
     userinput = GetInput();
     filelist.push_back(userinput);
 cout << "would you like to enter again? ('yes' or 'no'";
 cin >> stopstring;
 if  (stopstring = "no")
    stop = true;
    else
    stop = false;
 }
//run the get greatest function
    Greatest = GreatestInput();
//display the greatest on the screen
    cout << "The largest file is " << Greatest << " MB";
    return 0;
}

ignore the comments on GreatestInput() forgot they were there
Topic archived. No new replies allowed.