Can anyone help please

okay so I have to write this nested loop so that it outputs a V, i am having a hard time getting the rest of this v. I only can get the \ part of it, but cannot get the / part can anyone give me some insight on what i am doing wrong..

The code is:




#include <iostream>
using namespace std;

int main()
{
int size = 0;
while (size < 1 || size > 10)
{
cout << "please enter a number from 1-10: ";
cin >> size;
}
for (int row = 1; row <= size*2-1; row++)
{
for (int col = 1; col <= size; col++)
{
if (row == col || col == size*2-1)
cout << "*";
else
cout << " ";
}
cout << "\n";
}
system("pause");

return 0;
}
Does anyone know? still cant figure it out!
hello!

#include <iostream>
using namespace std;

int main()
{
int size = 0;
while (size < 1 || size > 10)
{
cout << "please enter a number from 1-10: ";
cin >> size;
}
for (int row = 1; row <= size; row++)
{
for (int col = 1; col <= size*2; col++)
{
if (row == col || (row + col == 2*size))
cout << "*";
else
cout << " ";
}
cout << "\n";
}
system("pause");

return 0;
}
Thanks Onts' now to get a inverted V, i will have to change around with the for statements and if rite..
Topic archived. No new replies allowed.