954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Star banner

Hello people,
This is first time i am using this site to get help.
Any way to the point, The code provided below suppose to make a blocks of squares with certain rows and column.
All the field, rows and columns are controlled by user. User can also choose which char they want to print( You can use * for simple use).
Let me know if any more help needed to solve.
For some reason I get error saying that i didn't declare my rows, column and char
Help will be greatly appreciated!

#include <iostream>
using namespace std;
void func1(int rows,int column,int blocks,char symbol);
void func2(int rows,int column,int blocks,char symbol);
void display ();

int main ()
{
	display();
}

void func1(int &rows,int &column,int &blocks,char &symbol)
{
	cout << "Please enter Char: ";
	cin >> symbol;
	cout<< "Please enter the number of Blocks(Please enter between 3 and 10): ";
	cin >> blocks;
	if (blocks < 3 || blocks > 10)
	{
		do
		{
			cout << "You entered value out of range please enter the value between 3 and 10: ";
			cin >> blocks;
		}
		while (blocks < 3 || blocks > 10);
	}
	cout << "Please enter the numbe of rows: ";
	cin >> rows;
	if (rows < 1 || rows > 5)
	{
		do
		{
			cout << "You entered value out of range please enter the value between 1 and 5: ";
			cin >> rows;
		}
		while (rows < 1 || rows > 5);
	}
	cout << "Please enter the number of columns: ";
	cin >> column;
	if (column < 5 || column > 50)
	{
		do
		{
			cout << "You entered value out of range please enter the value between 5 and 50: ";
			cin >> column;
		}
		while (column < 5 || column > 50);
	}
}

void func2 (int rows,int column,int blocks,char symbol)
{
	for (int row = 0; row < rows; row++){
		for (int block = 0; block < blocks; block++) {
			for (int col = 0; col < column; col++) {
				return (symbol);
			}
			cout<<"\t";
		}
		cout << endl;
	}
}

void display ()
{
	int rows,column,blocks;
	char symbol;
	func1 (rows,column,blocks,symbol);
	func2 (rows,column,blocks,symbol);
}
parth27987
Newbie Poster
13 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

Please post the error you get (the whole error report)

SgtMe
Nearly a Posting Virtuoso
1,205 posts since Oct 2009
Reputation Points: 68
Solved Threads: 85
 

Error 1 error C2668: 'func1' : ambiguous call to overloaded function
2 IntelliSense: more than one instance of overloaded function "func1" matches the argument list:

These are the errors i get!


And for line 56. I have code as : cout << symbol;

parth27987
Newbie Poster
13 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

Well this may help you out on the first error. Not sure about the seconds one. Which lines are they on?
http://www.gamedev.net/community/forums/topic.asp?topic_id=149452

SgtMe
Nearly a Posting Virtuoso
1,205 posts since Oct 2009
Reputation Points: 68
Solved Threads: 85
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: