C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 6th, 2012, 03:14 PM
ali_cruse ali_cruse is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 2 ali_cruse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 2 sec
Reputation Power: 0
Please help regarding C++ Loops Coding

Hi,
Please let me know how to get the following outputs using C++.



First one
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


second one

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


third one:

0
111
22222
3333333

Regards.

Reply With Quote
  #2  
Old December 7th, 2012, 12:46 AM
Jones21 Jones21 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 8 Jones21 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 42 sec
Reputation Power: 0
come on!




Reply With Quote
  #3  
Old December 7th, 2012, 03:09 AM
ali_cruse ali_cruse is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 2 ali_cruse User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 2 sec
Reputation Power: 0
What does it mean....

Hey Jones21 .... what does it mean ... come on ...
you just placed the links of hosting websites.... i asked here for help.... regarding these loops...

Reply With Quote
  #4  
Old January 9th, 2013, 07:48 AM
leonvictor2012 leonvictor2012 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Posts: 12 leonvictor2012 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 27 m 40 sec
Reputation Power: 0
Regarding C++ loops code

I think you should try this code,

#include <iostream>
using namespace std;
int main (){
int i,j,k,a;
char mat[5][5];
for (i=0;i<5;i++){
for(j=0;j<5;j++){
k=(i-j);
do{
if (k>=0){
mat[i][j]='+';
cout<<mat[i][j];}
else {
cout<<" ";}}
while (a=0);}
cout<<"\n";}
system("PAUSE");
return 0;}

Reply With Quote
  #5  
Old February 7th, 2013, 09:13 PM
ratina10 ratina10 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 2 ratina10 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 59 m 39 sec
Reputation Power: 0
Facebook
Program Solution

First one :

#include <iostream>
using namespace std;

int main()
{
int i,j,k;
for( i =1;i<=6;i++)
{

for(j=1;j<i;j++)
{
cout<<" "<<j;
}
for( k=j-2;k>0;k--)
{
cout<<" "<<k;
}
cout<<endl;
}

}

Second one :

#include <iostream>
using namespace std;

int main()
{
int i,j;

for(i=5;i>0;i--)
{
for(j=i;j<=5;j++)
{
cout<<" "<<j;
}
cout<<endl;
if(i==1)
goto xy;
}

xy:

for(i=6;i>0;i--)
{
for(j=1;i-j>0;j++)
{
cout<<" "<<j;
}
cout<<endl;
}
}

Third one:

#include <iostream>
using namespace std;

int main()
{
int i,j,k=1;

for(i=0;i<4;i++)
{
for(j=0;j<k;j++)
{
cout<<" "<<i;
}
k=k+2;
cout<<endl;
}
}


try it................

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Please help regarding C++ Loops Coding


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap