There is no standard called size().
When you do something like this -
'a' + 'b'
It adds the ASCII equivalent of 'a' and 'b'. If they were 10 and 11 respectively, you will get 21.
Integers aren't the same as strings or characters.
cout converts an integer to a string automatically for you, and you're supposed to separate your integers and strings and everything with
<<
.
Same thing with cin, but use
>>
.
Example -
cout << "IT'S OVER " << 9000 << "!!";
A for loop is supposed to be like this -
for ( initialization; condition; command )
The initialization is done only once, when the loop starts. Usually, variables are declared there.
The condition is checked if it's true. If it is, it continues the loop.
The loop is done afterwards.
Then the command is executed, then it checks the condition and if it's true, it does the loop again.
You can skip the initialization or the command if you want, but you must keep the semi-colons, here's an example -
for ( ; condition; )
EDIT: It doesn't know that sizea() exists until AFTER main().
You have two options -
A - Put sizea() before main()
B - Make a function prototype.
A function prototype is like the declaration of a function before it's implemented..
Put the prototype before main().
A prototype looks like this -
itsOver( int number );
for a function that looks like -
1 2 3 4
|
itsOver( int number )
{
return number;
}
|