Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 09-09-2011, 02:43 PM   #1 (permalink)
Night Fury
 
mayoorite's Avatar
 
Join Date: Jun 2011
Location: Ajmer,Rajasthan
Posts: 99
Exclamation Help in C++ programming!


HI!
I NEED C++ CODING TO MAKE A PATTERN USING NESTED LOOP.
I HAVE ATTACHED THE TEXT FILE FOR PATTERN.
PLEASE HELP ITS URGENT!!

Last edited by mayoorite; 09-09-2011 at 04:07 PM.
mayoorite is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 09-09-2011, 03:17 PM   #2 (permalink)
gkbhat.blogspot.com
 
Join Date: Apr 2008
Location: Mangalore/Bangalore
Posts: 103
Default Re: Help in C++ programming!

I cannot see any pattern in the file Post a snapshot of the pattern and what have u tried to solve it
__________________
blogging at http://gkbhat.blogspot.com
gk2k is offline  
Old 09-09-2011, 05:10 PM   #3 (permalink)
The Assassin
 
Cybertonic's Avatar
 
Join Date: May 2010
Location: Delhi
Posts: 620
Default Re: Help in C++ programming!

This ones pretty easy. First make a loop for the spaces at the left (i=0;i<=4;i++) and inside it make another loop for "& " (j=4;j>=0;j--).
__________________
Nothing is true. Everything is permitted.

Steam : $/@$]-[ DK
http://steamcommunity.com/profiles/76561198047340352
Cybertonic is offline  
Old 09-09-2011, 07:36 PM   #4 (permalink)
Sami Hyypiä, LFC legend
 
Liverpool_fan's Avatar
 
Join Date: Jun 2007
Location: Нью-Дели
Posts: 2,138
Default Re: Help in C++ programming!

12 hours you have to post your own attempt, doesn't matter it works or not but an honest attempt must be seen. Otherwise thread will be locked. No hand helding solutions, those posts will be deleted.
__________________
Experience true education in Computer Science - http://www.udacity.com | http://www.coursera.org

Spoiler:
Read before asking / messaging any moderator for any query: FAQ + answers for new members

Read all the sticky threads before asking any type of query. Most basic questions are answered in those.
Don't use forum for chatting. Visit http://webchat.freenode.net/?channels=krow, enter nick and connect.
Liverpool_fan is offline  
Old 09-09-2011, 08:08 PM   #5 (permalink)
Night Fury
 
mayoorite's Avatar
 
Join Date: Jun 2011
Location: Ajmer,Rajasthan
Posts: 99
Default Re: Help in C++ programming!

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int i,j;
for(i=0;i<=4;i++)
{ for(j=4;j>=i;j--)
cout<<" &";
cout<<endl;
}
getch();
}

I don`t know how to increase 1 space in every loop.
please help!
mayoorite is offline  
Old 09-09-2011, 08:12 PM   #6 (permalink)
Sami Hyypiä, LFC legend
 
Liverpool_fan's Avatar
 
Join Date: Jun 2007
Location: Нью-Дели
Posts: 2,138
Default Re: Help in C++ programming!

Try running a parallel inner loop which prints increasing amount of spaces (or tabs) with each increasing iteration. That is before the inner loop '&' executes, another loop executes which prints spaces ahead of it.
__________________
Experience true education in Computer Science - http://www.udacity.com | http://www.coursera.org

Spoiler:
Read before asking / messaging any moderator for any query: FAQ + answers for new members

Read all the sticky threads before asking any type of query. Most basic questions are answered in those.
Don't use forum for chatting. Visit http://webchat.freenode.net/?channels=krow, enter nick and connect.

Last edited by Liverpool_fan; 09-09-2011 at 08:19 PM. Reason: Misunderstood ther question
Liverpool_fan is offline  
Old 09-09-2011, 08:18 PM   #7 (permalink)
BIOS Terminator
 
nims11's Avatar
 
Join Date: Apr 2008
Location: Ranchi
Posts: 816
Default Re: Help in C++ programming!

add a for loop before the for loop that prints the '&' to print number of spaces according to i.
nims11 is online now  
Old 09-09-2011, 08:54 PM   #8 (permalink)
I am the night! I am....
 
vickybat's Avatar
 
Join Date: Aug 2009
Location: Gotham City
Posts: 4,209
Default Re: Help in C++ programming!

@ mayoorite

Check the following buddy. Its prints a reverse equilateral triangle according to your needs.

Code:
#include<iostream>

using namespace std;

 

int main()

{

int n,i,space,column;

char a= '&';

cout<<"Enter the number of rows: "<<endl;

cin>>n;

 

for(i=n;i>0;i--)

      {

      for(space=0;space<n-i;space++)cout<<" "; //assigning spaces

          cout<<a<<" "; //Writing the "&" character after assigning spaces

          for(column=i-1;column>0;column--)cout<<a<<" "; //writing the "&" character in the columns

          cout<<endl;

          }
          
    cin.ignore();
     cin.get();

return 0;

}
__________________
core i5 750, biostar h55 A+ (X16+X4), 4gb 1333 ddr3, corsair vx450, cm elite 335,Asus EAH 5750 FORMULA , samsung 2033 sw plus, wd green 1tb , wd 1tb my book , hp dvd writer,Apc 650 va, logitech z313

Last edited by vickybat; 09-09-2011 at 08:59 PM.
vickybat is offline  
Old 09-09-2011, 08:58 PM   #9 (permalink)
Night Fury
 
mayoorite's Avatar
 
Join Date: Jun 2011
Location: Ajmer,Rajasthan
Posts: 99
Default Re: Help in C++ programming!

can anyone please write the code.
i am a beginner and have learned loops yesterday.
mayoorite is offline  
Old 09-09-2011, 09:24 PM   #10 (permalink)
BIOS Terminator
 
nims11's Avatar
 
Join Date: Apr 2008
Location: Ranchi
Posts: 816
Default Re: Help in C++ programming!

Code:
for(int k=0;k<i;k++)
cout<<" ";
simply add this line just before the 2nd for loop of your program.
nims11 is online now  
Old 09-09-2011, 10:06 PM   #11 (permalink)
Night Fury
 
mayoorite's Avatar
 
Join Date: Jun 2011
Location: Ajmer,Rajasthan
Posts: 99
Default Re: Help in C++ programming!

THANKS TO ALL FINALLY I GOT THE CORRECT WAY .
I HAVE USE THE BELOW CODE FOR IT.
Code:
#include<iostream.h>
#include<conio.h>
main()
{
	clrscr();
	int i,j,k,n;
	cout<<"Enter rows:";
	cin>>n;
	for(i=0;i<=n-1;i++)
       {		
		for(k=0;k<=i;k++)
		cout<<" ";
		for(j=n-1;j>=i;j--)
		cout<<" &";
		cout<<endl;
       }
       getch();
}
LOOP->

Last edited by mayoorite; 09-09-2011 at 10:04 PM.
mayoorite is offline  
Old 09-09-2011, 10:49 PM   #12 (permalink)
I am the night! I am....
 
vickybat's Avatar
 
Join Date: Aug 2009
Location: Gotham City
Posts: 4,209
Default Re: Help in C++ programming!

^^ Good job buddy. Keep practicing. C++ is very very interesting.
__________________
core i5 750, biostar h55 A+ (X16+X4), 4gb 1333 ddr3, corsair vx450, cm elite 335,Asus EAH 5750 FORMULA , samsung 2033 sw plus, wd green 1tb , wd 1tb my book , hp dvd writer,Apc 650 va, logitech z313
vickybat is offline  
Old 10-09-2011, 12:53 AM   #13 (permalink)
gkbhat.blogspot.com
 
Join Date: Apr 2008
Location: Mangalore/Bangalore
Posts: 103
Default Re: Help in C++ programming!

@OP: Glad that you where able to solve it. You think that you cannot do something until you do it.
__________________
blogging at http://gkbhat.blogspot.com
gk2k is offline  
Old 10-09-2011, 07:52 AM   #14 (permalink)
Sami Hyypiä, LFC legend
 
Liverpool_fan's Avatar
 
Join Date: Jun 2007
Location: Нью-Дели
Posts: 2,138
Default Re: Help in C++ programming!

I guess the thread has run its course.
__________________
Experience true education in Computer Science - http://www.udacity.com | http://www.coursera.org

Spoiler:
Read before asking / messaging any moderator for any query: FAQ + answers for new members

Read all the sticky threads before asking any type of query. Most basic questions are answered in those.
Don't use forum for chatting. Visit http://webchat.freenode.net/?channels=krow, enter nick and connect.
Liverpool_fan is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:34 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2