tanmay wrote:
please tell me how to get the following output using loops...
1) *
* *
* * *
* * * *
* * *
* *
*
2) abcdefgfedcba
abcdefedcba
abcdedcba
abcdcba
abcba
aba
a
please solve them using for loop......
thankyou very much for solving my problem...
#include <iostream>
int main() {
const char* foo[] = {
"1) *\n"
" * *\n"
" * * *\n"
" * * * *\n"
" * * *\n"
" * *\n"
" *\n\n\n"
,
"2) abcdefgfedcba\n"
" abcdefedcba\n"
" abcdedcba\n"
" abcdcba\n"
" abcba\n"
" aba\n"
" a\n\n" };
for (int k = 0; k < 1; ++k)
for (int j = 0; j < 1; ++j)
for (int i = 0; i < sizeof(foo)/sizeof(foo[0]); ++i)
std::cout << foo[i];
}
There are for loops and the output should be exactly as you asked.
You're welcome!
Oh, and check out
http://www.parashift.com/c++-faq-lit...t.html#faq-5.2
for more information on your inquiry.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask