Please help with is program

Mar 17, 2014 at 4:39pm
write a function that receives an positive integers x, and then display following matrix:
11 12 13...1x
.
.
x1 x2 x3...xx

Please help.. Thanxx
Mar 17, 2014 at 4:49pm
For example ,if the number that the function receive is 4, then the function should display a matrix as following:
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44
Mar 17, 2014 at 5:09pm
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
29
30

#include <iostream>
using namespace std;

void doMatrix(int count);

int main()
{
	// run and display 5 rows
	doMatrix(5);
	return 0;
}

void doMatrix(int count)
{
	// declare columns with initial values.
	int col1 = 11, col2 = 12, col3 = 13, col4 = 14;

	// loop adding 10 each time
	for (int i = 0; i < count; i++)
	{
		cout << col1 << "\t" << col2 << "\t" << col3 << "\t" << col4 << endl;
		// add 10 to each column
		col1 += 10;
		col2 += 10;
		col3 += 10;
		col4 += 10;
	}
}
Mar 17, 2014 at 5:14pm
Thank you very much
Mar 17, 2014 at 5:22pm
Can you please try to help me with this program

Write a function that receives a positive integer and display each digit of such integer one digit per line. For example, if the integer the function receives 2475, then it should display the digits of this number as following:
Mar 17, 2014 at 5:31pm
Just curious why you would need that?
Mar 17, 2014 at 5:33pm
I'm doing an exercises from my book, I need help with them to check my work..
Please if you can do it help
Mar 17, 2014 at 5:36pm
For example, if the integer the function receives 2475, then it should display the digits of this number as following:
5
7
4
2
Mar 17, 2014 at 5:36pm

I dont mind helping but in all honesty if I keep doing the work for you then are you actually going to learn from it? - the whole point is to try and solve the problems yourself and that way you learn from it.

Mar 17, 2014 at 5:39pm
actually you helped a lot for the other question I understand it very well
Mar 17, 2014 at 5:46pm
Mar 17, 2014 at 5:54pm

So, what your looking at is something like this...


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

#include <iostream>
#include <string>
using namespace std;

int main()
{
	string myNumber;

	cout << "Enter a number:";
	cin >> myNumber;

	myNumber = string(myNumber.rbegin(), myNumber.rend());
	cout << myNumber;
}
Topic archived. No new replies allowed.