473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

looping problems...

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...

Jul 10 '07 #1
1 1851
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
Jul 10 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: bellefy | last post by:
Hi All, I have a fairly large table with approx 30K rows that updates every night via a cron script that automatically downloads the 2 new csv's. The problem is the files are downloaded from...
2
by: Claire Reed | last post by:
Dear All, I am repeatedly encountering a problem whilst looping through XML Nodes and I am unsure as to what is going on and how I can get around it. I load the following XML document into an...
2
by: pj | last post by:
Code below is on continuous form. Depending on a Y/N field value the colours should change on the form. Although the looping appears to work it sets all controls in each record to the first...
14
by: John Salerno | last post by:
Here's an exercise I was doing to guess a number from 1-100. Just for fun (ha ha) I decided to add some error checking too, and now when I run it, the DOS prompt flashes real quick and disappears....
2
by: Bart Van Hemelen | last post by:
The situation: I have a CheckBoxList cblTest, the items are disabled in cblTest_DataBound in a foreach (ListItem oItem in cblTest.Items) loop. I provide a link that calls a client-side JavaScript...
0
by: Jim S | last post by:
Is looping FindWindow() ok? We have a simple little c# 2.0 app that’s sole purpose is to look for a dialog box from another app to pop up and then click it’s OK button. To do this we use a...
22
Dököll
by: Dököll | last post by:
Hiya, Partners! I have been into it for 12 hours straight this week-end, my son is very unhappy. Looks like I am getting pretty close but need your help, Again. I will post my first...
2
by: hayz | last post by:
Flash sound file looping problems hello there I'm definitely a newb so please bare some patience. I have a flash sound file on the index page of a site i'm working on. First off i need the...
0
by: MikeDiver | last post by:
My first problem is that i was working on a project that had two radio buttons in it, i decided to delete one of them and now i cant get the second to activiate without being clicked (the second...
6
by: vbwire | last post by:
i use vb 6.0 Option Explicit Dim Error As Double Dim x As Integer Dim y As Double Dim z As Integer
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.