How to make a program that prints out 10 stars with using cout or for loops or while loops.

Recommended Answers

All 6 Replies

Assuming you're giving us all the information we need, there's a ton of ways to do this without using loops and cout. One could use standard C functions like puts() or printf(), for example.

 #include <cstdio>

 int main()
 {
     printf("**********");
     return 0;
 }

Or even putchar which makes even more sense.
How about write to stdout?
Maybe even write directly to screen memory. That's a neat way.
ಠ_ಠ

Or even putchar which makes even more sense.

How? putchar() only outputs a single character. If you're not allowed to use loops, you'll have to make ten calls to that in a row.

How to make a program that prints out 10 stars with using cout or for loops or while loops.

Nothing said about do-while... ;-)

That's still a 'while loop' isn't it? But what about goto? Special circumstances so...:D

yeah, goto! Or recursion!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.