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);
}

Recommended Answers

All 3 Replies

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

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;

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.