Mangaring, Eugene O. ENG - 158: // While Loop
Mangaring, Eugene O. ENG - 158: // While Loop
ENG_158
while ( y < x)
{
cout << X;y++;
}
cout << endl;
// While Loop
#include <iostream>
#include <conio.h>
}
}
while (x < 9);
getch();
// For Loop
#include <iostream>
#include <conio.h>
using namespace std;
main()
{
int x,y;
char star = 'x';
char space = ' p ';
int temp;
int numSpaces = 0;
for(x=1; x <= 9; x++)
{
}
getch();
if((x%2) != 0)
{
// Do-While Loop
#include <iostream>
#include <conio.h>
main()
{ int x,y=1,space = 0,i=0;
char X= 'x';
x=1;
do
{ if((x%2) != 0)
{
space = (11 - x) / 2;
x++;
while( i <space)
{cout << " ";
i++;
}
numSpaces = (11 - x) / 2;
}
}
getch();
}
/* Output
x
xxx
xxxxx
xxxxxxx
xxxxxxxxx