while loop c++

while loop c++

Page 1 of 1

3 Replies - 2428 Views - Last Post: 10 November 2008 - 11:26 AM Rate Topic: -----

#1 alawey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 10-November 08

while loop c++

Posted 10 November 2008 - 04:48 AM

hi my friend



// Convert 4 programs from for loop
// into while loop c++

// 1. Star
*****
****
***
**
*
// 2. factorial
// 3. Multiplication Table
// 4. Determine the prime numbers




pleace help me
Is This A Good Question/Topic? 0
  • +

Replies To: while loop c++

#2 chili5  Icon User is offline

  • D.I.C Lover

Reputation: 19
  • View blog
  • Posts: 1,144
  • Joined: 28-December 07

Re: while loop c++

Posted 10 November 2008 - 05:07 AM

If you have a specific problem, post your code and we can help you. :)

Hints:

1. For loop, and substring
2. Recursion
3. Nested for loops
4. Sieve of Eratosthenes
Was This Post Helpful? 0
  • +
  • -

#3 no2pencil  Icon User is offline

  • Head MFIC
  • member icon

Reputation: 5066
  • View blog
  • Posts: 26,449
  • Joined: 10-May 07

Re: while loop c++

Posted 10 November 2008 - 05:14 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.

Please post like this:

Thank you for helping us helping you.
Was This Post Helpful? 0
  • +
  • -

#4 UG Cyber  Icon User is offline

  • D.I.C Addict

Reputation: 32
  • View blog
  • Posts: 546
  • Joined: 24-July 08

Re: while loop c++

Posted 10 November 2008 - 11:26 AM

If you look at a for loop. You notice that the best part about it is that it is indexed. so you can easily make it do the same thing by indexing an int in a while loop
for (int i = 0; i < SomeNumber; i++)
{
	 cout << Array[i];
}


int i = 0;
while (i < SomeNumber)
{
   i++;
   cout << Array[i];
}



Those two codes do the EXACT same thing.

you DO need to post up YOUR CODES. It shows us that you are putting forth effort and it also lets us know what the error is. I'm just in a good mood :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1