Hello, I just started trying to learn c++ a few days ago. Right now I have run into probems, which, has always happened when I try to learn a programming language. Can anyone help me fix this simple multiplication program?

#include <iostream> 
int Multiply27( first, second) 
{
	cout << "in multiply" << endl;
	return (first * second);
}
int main()
{
	using std::cout;
	using std::endl; 
	using std::cin;
	
	cout << "Let's Multiply!!!" << endl; 
	int a, b, c; 
	cout << "Ill let you multiply two numbers" << endl; 
	cout << "What numbers do you want those to be?" << endl; 
	cout << "number one: "; 
	cin >> a; 
	cout >> "number two: "; 
	cin >> b; 
	c=Multiply27(a ,b); 
	cout << "The answer is: " << c; 
	return 0; 
}

Recommended Answers

All 2 Replies

move lines 9-11 up to between lines 1 and 2. As coded, line 4 can not use cout because it doesn't know what cout is.

Other than that, what is the problem with your program?

Nevermind, I was able to solve it by doing this.

#include <iostream> 
int Multiply27( int first, int second) 
{
	return (first * second);
}
int main()
{
	using std::cout;
	using std::endl; 
	using std::cin;
	
	cout << "Let's Multiply!!!" << endl; 
	int a, b, c; 
	cout << "Ill let you multiply two numbers" << endl; 
	cout << "What numbers do you want those to be?" << endl; 
	cout << "Number one: ";
	cin >> a;
	cout << "Number two: ";
	cin >> b;
	c=Multiply27(a ,b); 
	cout << "The answer is: " << c << endl; 
	return 0; 
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.