I need help to create this design(using nested loops)

pls help..i got xam the day afta 2moro

Page 1 of 1

5 Replies - 2416 Views - Last Post: 19 January 2008 - 07:20 AM Rate Topic: -----

#1 SPS   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 18-January 08

I need help to create this design(using nested loops)

Post icon  Posted 18 January 2008 - 11:16 AM

I need help to create this design


1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1

pls help.....

This post has been edited by SPS: 18 January 2008 - 11:23 AM

Is This A Good Question/Topic? 0
  • +

Replies To: I need help to create this design(using nested loops)

#2 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6642
  • View blog
  • Posts: 30,931
  • Joined: 10-May 07

Re: I need help to create this design(using nested loops)

Posted 18 January 2008 - 11:23 AM

What part are you having trouble with?

:code:
Was This Post Helpful? 0
  • +
  • -

#3 manzoor   User is offline

  • D.I.C Regular
  • member icon

Reputation: 13
  • View blog
  • Posts: 468
  • Joined: 07-August 07

Re: I need help to create this design(using nested loops)

Posted 18 January 2008 - 11:49 AM

Post your code so that the members can help you out.
Posted Image

Thanks.

This post has been edited by manzoor: 18 January 2008 - 11:51 AM

Was This Post Helpful? 0
  • +
  • -

#4 SPS   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 18-January 08

Re: I need help to create this design(using nested loops)

Posted 19 January 2008 - 01:46 AM

dude...i dont know how to use the loops properly to get the design.....its pretty confusing...please help
Was This Post Helpful? 0
  • +
  • -

#5 jjhaag   User is offline

  • me editor am smartastic
  • member icon

Reputation: 48
  • View blog
  • Posts: 1,789
  • Joined: 18-September 07

Re: I need help to create this design(using nested loops)

Posted 19 January 2008 - 01:54 AM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

If you have yet to write any code for this, take a look at the C/C++ snippets, tutorials, and FAQ for inspiration, examples, and explanations of the techniques that you are required to use.

Thanks.
Was This Post Helpful? 0
  • +
  • -

#6 baavgai   User is online

  • Dreaming Coder
  • member icon


Reputation: 7181
  • View blog
  • Posts: 14,969
  • Joined: 16-October 07

Re: I need help to create this design(using nested loops)

Posted 19 January 2008 - 07:20 AM

View PostSPS, on 19 Jan, 2008 - 03:46 AM, said:

dude...i dont know how to use the loops properly to get the design.....its pretty confusing...please help


Surely anyone who assigned this to you would have explained loops? If you really need a explanation, loops are ubiquitous, there are probably millions of examples in google.

Just in case google, somehow, isn't working for you, this is how a loop works:
#include <iostream>
using namespace std;

int main () {
	// this says, initialize a variable named i 
	// and assign it the value of 1
	// if the value currently in i is less than 5, keep going
	// once the code in this block is executed, increment i by one
	// keep executing the code in the block until i fails the test, i<5
	for(int i=1; i<5; i++) {
		// print the current value of i, and a space
		cout << i << " ";
	}
	// print a new line
	cout << endl;
	return 0;
}

// produces the following output:
//1 2 3 4



Hope this helps.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1