Help with loop

I need to repeat this line 3 more times but i'm not sure how to.

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
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main ()
{

	int rowcount = 0;
	int widthcount = 0;


	while (widthcount <= 12)
	{
		if (widthcount <= 12)
			{
				printf("*");
				widthcount++;
			}
			else
				printf("\n");
	}

	printf("\n");
	system ("pause");
	return 0;
}

first what line do you need to repeat second if you want proper syntax:
stdio.h --> iostream
stdlib.h --> cstdlib
math.h --> cmath
printf("") --> cout<<""
well i need the while loop to repeat so it makes something like this:

*************
*************
*************
*************

and ok thanks
Put another loop around it:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
int main (){
	int rowcount = 0;
	int widthcount = 0;
	while (rowcount < 4){
		while (widthcount < 13){
			printf("*");
			widthcount++;
		}
		printf("\n");
		rowcount++;
	}
	system ("pause");
	return 0;
}
Last edited on
ok how about this:
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
#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
int loop_through = 1, star_out = 0;

while(loop_through <= 4)
{
while(star_out < 13)
{
cout<<"*";
star_out++;
}

if(star_out == 13)
{
cout<<"\n";
loop_through++;
star_out = 0;
}
}

exit (1);
}
Thank you i just kept putting the rowcount++ in the wrong spot
Topic archived. No new replies allowed.