Hi Guys,
I'm trying to build a program to get the largest number of 20 numbers put in a program and the largest number is outputted on the screen:
Here's my code;
values3.h
Main program to get it to run - values.cppCode:// Determining the largest number
#include <iostream>
using namespace std;
#include <string>
class figures
{
public:
int get_largest_number(int a[]);
int display_largest_number();
protected:
int largest_number;
int i;
};
int figures::get_largest_number(int a[])
{
cout << "Enter Number: ";
cin >> a;
largest_number = a[0];
for(i=1; i<20; i++)
{
if(a[i] > largest_number)
{
largest_number = a[i];
}
}
return(largest_number);
}
So in theory the user enters 20 numbers which are stored in an array and then when the 20th number is finally entered it outputs the largest number entered on the screen.Code:// ASSIGN77.CPP
// A Program to display the largest number
#include "values_new.h"
#include <cstdlib>
int main ()
{
figures numbs;
numbs.get_largest_number(int a[]);
system ("pause");
}
When I try and run it though it comes up with an errors saying:
values3.h no match for 'operator>>' in 'std::cin >> a'
std::basic_istream<char, _Traits>& std::operator>>(std::basic_istream<char, _Traits>&, unsigned char&) [with _Traits = std::char_traits<char>]
Can anyone please advise to where I have gone wrong?
Thanks