How do I print out a square of stars with different length and width given?

#include <iostream>
using namespace std;
int main()
	int h,v,num;
	cout<<"Give a value for length ";
	cout<<"Give a value for width ";
	for(int i= 0;i<=v;i++)
		for(int r=0;r<=h;r++)
	return 0;

how do i change this code to accept two numbers from the user and print it as the different length and widtth? it has to be a for loop as well.[code]
Last edited on
Do you know how to write a for loop? Try that part first (I recommend scrapping your current code and only keeping it for future reference)
Yea i wasnt planning on using this code. Just used it as an example cause i had nothing on me at the moment. I have another code on my other computer. but it just gave me an infinite loop or just didnt compile anything
You can try writing a program from scratch. Start with asking the user to input the width and height.
Its printing out one extra star for the horizontal line.
got it :D
Topic archived. No new replies allowed.