Ok, I'm not too sure if this would be considered a matrix, but what I'm trying to do promts the user for 2 characters, and one integer.
For example, say you key in * G 3
the cout would be...
*G*
G*G
*G*
If you keyed in % $ 5
%$%$%
$%$%$
%$%$%
$%$%$
%$%$%
I've tried various scenarios of code, and havent had much progress. I have however worked out what I *think* is the correct formula for odd integer inputs, and evens.
for example, if the entries are 0 * 6, where n = 6, then my multiplier formula would be ((n/2)-1).
so, it would result in:
0 and *, being multiplied by (6/2)-1, which is 2, resulting in the correct... 0*0*0* (eg. the initial output with another 2)
and if it is an odd number, ((n-1)/2)-1
Now, my problem is... how do I get the program to know its Odd numbers or even numbers...? and where do I insert my formula?
Second... how do I solve the multiple rows issue? I know how to get the columns (with my formulas).
I'm fairly new to C++, and I've done these so far... but I stopped when I realised it would be neverending... any ideas? :-/
#include <iostream>
using namespace std;
int main ()
{
char x, y;
int n;
cout << "Enter two characters and an integer: ";
cin >> x >> y >> n;
if (n == 1)
cout << x;
else if (n == 2)
cout << xy;
cout << yx;
return 0;
}