Warning 3.10.1.
It is unnecessary and illegal to include the type when you pass variables as arguments! The type is only needed for declaration.
void printTime(int hour, int minute) {
cout << hour;
cout << ":";
cout << minute;
}
(int hour, minute)
, but that format is only legal for variable declarations, not for parameters.
int hour = 11;
int minute = 59;
printTime(int hour, int minute); // WRONG!
totalcost(double cost, tax, discount)
totalcost
needs a return type, and each parameter needs a data type.totalCost(double cost, double tax) {
totalcost
needs a return type.void totalCost(double cost, double tax, double discount) {
void multiplyTwo(int num, string name) {
int total = num * 2;
cout << "Hi " << name << ", your total is " << total << "!" << endl;
}
int main() {
int x = 2;
string phil = "Phil";
}
multiplyTwo(int x, string phil);
multiplyTwo (x, phil);
void multiplyTwo(int num, string name) {
void multiplyTwo(int x, string phil);