@Reshgod
(1) please don't double-post: it prompts ire rather than code;
(2) it's not the most difficult assignment under the sun - please have a try first. http://www.cplusplus.com/doc/tutorial/control/#for
This should be close to what you asked for. Such simple starter programs (typically < 10 total lines) I will help with but you need to start trying and learning or you will soon ask things I refuse to help with.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
usingnamespace std;
int main()
{
int a,b;
cin >> a >> b;
for(int i = 1; i <=a*b; i++)
{
cout << (i%b ? "x" :"x\n");
}
if(a!=1&&b!=1)
cout<< a + a-2 + b-1+b-1 << endl;
else
cout << a*b << endl;
}
while you are working on it you can double check my perimeter count logic. I think it works but I only tested a few basic cases. Whole thing goes wrong if you type in negatives / junk of course. It works for 1x1, 1x2, 2x1, and 2x2 and bigger as far as I can tell.