Hi, I'm having some issues understanding these errors, could someone please explain why I'm getting them/ how to fix? Thank you, it's greatly appreciated
errors:
6_1.cpp: In function âint main()â:
6_1.cpp:13:61: error: too many arguments to function âint tripleIt()â
cout << "\nValue returned by tripleIt is " << tripleIt(value); << endl;
^
6_1.cpp:7:5: note: declared here
int tripleIt();
^
6_1.cpp:13:64: error: expected primary-expression before â<<â token
cout << "\nValue returned by tripleIt is " << tripleIt(value); << endl;
^
6_1.cpp:15:23: error: too many arguments to function âint tripleIt()â
value = tripleIt(value)
^
6_1.cpp:7:5: note: declared here
int tripleIt();
^
6_1.cpp:16:1: error: expected â;â before âcoutâ
cout << "In main value now is " << value << endl;
^
6_1.cpp:17:23: error: too many arguments to function âint tripleIt()â
value = tripleIt(value)
^
6_1.cpp:7:5: note: declared here
int tripleIt();
^
6_1.cpp:18:1: error: expected â;â before âcoutâ
cout << "In main value now is " << value << endl << endl;
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
|
#include <iostream>
#include <cstdlib>
using namespace std;
void printMessage();
int tripleIt();
int main()
{
int value = 2;
cout << "Hello from main.\n";
printMessage();
cout << "\nValue returned by tripleIt is " << tripleIt(value); << endl;
cout << "In main value now is " << value << endl << endl;
value = tripleIt(value)
cout << "In main value now is " << value << endl;
value = tripleIt(value)
cout << "In main value now is " << value << endl << endl;
cout << "Goodbye from main.\n";
return 0;
}
void printMessage()
{
cout << "Hello from PrintMessage.\n";
}
int tripleIt(int someNum)
{
return someNum * someNum * someNum;
}
|