Help my little bro

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
ssj4goku128
Insane DCEmu
Insane DCEmu
Posts: 290
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Help my little bro

Post by ssj4goku128 »

Yo... I got a question. I am trying to help my little bro out in programming, but the program still is wrong. If someone can help him that would be great. His teacher said he can only use a function 1 time, so that excludes recursion from this program and recalling of functions in other ones(so once a() calls b(), c() cannot call b()). The output should be a Christmas tree[which it does output].

Code: Select all

#include <iostream.h>

/*void draw(int endSpace, int beginSpace, int endStar, int initStar)
{
	bool complete=false;
	while(!complete)
	{
		
		for(int spaces=0;endSpace>spaces;spaces++)
		{
			cout<<" ";
		}
		endSpace-=1;
		for(int stars=initStar;stars<endStar;stars++)
		{
			cout<<"*";
		}
		cout<<endl;
		
		endStar+=2;
		if(endSpace==beginSpace) complete=true;
	}
}*/

void drawRow(int maxSpaces, int maxStars)
{
	for(int spaces=0;spaces<maxSpaces;spaces++)
	{
		cout<<" ";//drawSpace();
	}
	for(int stars=0;stars<maxStars;stars++)
	{
		cout<<"*";//drawStar();
	}
	cout<<endl;//nextRow();
}
void drawTree(int maxSpaces, int maxStars, int draws)
{
	int maxStar=maxStars;
	for(int maxSpace=maxSpaces; maxSpace>=8;maxSpace--)
	{
		drawRow(maxSpace,maxStar);
		maxStar+=2;
	}	
	draws++;
	if(draws>3)
	{
		return;
	}
	else
	{
		drawTree(maxSpaces-2,maxStars+4,draws);
	}	
}
/*
void drawNextSection()
{
	int maxStars=6;
	for(int maxSpaces=12; maxSpaces>6;maxSpaces--)
	{
		drawRow(maxSpaces,maxStars);
		maxStars+=2;
	}
}
void drawBottom()
{
	int maxSpaces=12;
	int maxStars=6;
	for(int rows=0;rows<6;rows++)
	{
		drawRow(maxSpaces,maxStars);
	}
}*/
void main(void)
{
	int maxStars=1;
	int maxSpaces=15;
	int initDraws=1;
	drawTree(maxSpaces,maxStars,initDraws);
	/*for(int EndSpace=14;endSpace<=EndSpace;EndSpace-=2)
	{
		draw(endSpace,4,endStars,beginStars);
		endStars+=2;

	}*/
}
"So I gotta be carefull, can't let tha evil of tha money trap me
so when ya see me #@#$%
ya better holla at me "

Tupac Shakur[1971-1996]
Makaveli[1996-????]
ssj4goku128
Insane DCEmu
Insane DCEmu
Posts: 290
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by ssj4goku128 »

My example uses recursion.
"So I gotta be carefull, can't let tha evil of tha money trap me
so when ya see me #@#$%
ya better holla at me "

Tupac Shakur[1971-1996]
Makaveli[1996-????]
WHurricane16
DC Developer
DC Developer
Posts: 92
Joined: Wed Oct 17, 2001 7:44 pm
Location: Cape Fear Region, NC
Has thanked: 0
Been thanked: 0
Contact:

Post by WHurricane16 »

User avatar
toastman
Iron Fist of Justice
Iron Fist of Justice
Posts: 4933
Joined: Sat Nov 10, 2001 3:08 am
Location: New Orleans
Has thanked: 0
Been thanked: 0
Contact:

Post by toastman »

Well, I'm not going to write it but
Loops, spacing values. Keep it simple.
That's all. One function.
No signature.
BlackAura
DC Developer
DC Developer
Posts: 9951
Joined: Sun Dec 30, 2001 9:02 am
Has thanked: 0
Been thanked: 1 time

Post by BlackAura »

A couple of loops would do the trick.

You don't need recursion for that, and it's likely to get in your way. It's not like your traversing a binary tree or anything - you're just drawing a load of characters on the screen.
User avatar
toastman
Iron Fist of Justice
Iron Fist of Justice
Posts: 4933
Joined: Sat Nov 10, 2001 3:08 am
Location: New Orleans
Has thanked: 0
Been thanked: 0
Contact:

Post by toastman »

Yeah, we had a similar program to do for a programming competition a while back. Except you had to draw a hollow diamond with a user-inputted character.
No signature.
ssj4goku128
Insane DCEmu
Insane DCEmu
Posts: 290
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by ssj4goku128 »

Figured it out for him! I told him to switch majors as well man.... all he needed to do was to switch the recursion with a while loop.
"So I gotta be carefull, can't let tha evil of tha money trap me
so when ya see me #@#$%
ya better holla at me "

Tupac Shakur[1971-1996]
Makaveli[1996-????]
WHurricane16
DC Developer
DC Developer
Posts: 92
Joined: Wed Oct 17, 2001 7:44 pm
Location: Cape Fear Region, NC
Has thanked: 0
Been thanked: 0
Contact:

Post by WHurricane16 »

ssj4goku128 wrote:Figured it out for him!
I'm not trying to be a jerk or anything, but that's what I was trying to avoid. :? How's he suppose to learn anything that way?
crt0
DC Developer
DC Developer
Posts: 290
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by crt0 »

It was probably for him anyway, not some mythical 'little brother'. -_-
User avatar
toastman
Iron Fist of Justice
Iron Fist of Justice
Posts: 4933
Joined: Sat Nov 10, 2001 3:08 am
Location: New Orleans
Has thanked: 0
Been thanked: 0
Contact:

Post by toastman »

crt0 wrote:It was probably for him anyway, not some mythical 'little brother'. -_-
You've never had a "friend" who needed "help" before. ;)
Remember this is the guy who _was_ going to port PCSX to the DC, before someone else actually did it.



















BTW, I've deleted all of his coding "tutorials" so don't bother looking for proof of his ineptitude from there. I figured it was safer deleting them than risking people asking about them.
No signature.
ssj4goku128
Insane DCEmu
Insane DCEmu
Posts: 290
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by ssj4goku128 »

#1. I do have a little brother who needed help. He is in an AP course there, and I was doing him a favor.

#2. I figured it out for him. Thank you very much.

#3. A lot of you guys here at these forums post a bunch of egotistical crap. "Oh wow.... This guys was gonna do this... but didn't." Well if I remember correctly, it was many of you guys who stated that authors should release their things on their own time. So I am gonna tell yall to kiss my @$$ and have a nice day[btw... ctr0.. if I remember correctly, you were the same person who was yelling at me saying that the libGPU could not work with PCSX. Well, I proved you wrong their. If you want me to post up the link, I could do so for you]. BTW... for all you people that want an update [so long as you are not a mod as most of them just want to hate and pass heat] on PCSXDC, I have some pvr API to handle textures increasing the speed quite a bit. Hopefully by next week, I will have something to give the beta tester.
"So I gotta be carefull, can't let tha evil of tha money trap me
so when ya see me #@#$%
ya better holla at me "

Tupac Shakur[1971-1996]
Makaveli[1996-????]
Tangent
DC Developer
DC Developer
Posts: 100
Joined: Fri Jan 17, 2003 3:01 pm
Location: Pits of Insanity
Has thanked: 0
Been thanked: 0
Contact:

Post by Tangent »

He's taking an AP course, yet you tell him to switch majors? As I understand it, AP is high school. He shouldn't even have been able to decide what his major is yet. He definitely should change it, btw, if he can't solve a simple problem like that on his own.

Something doesn't quite add up here.
There are 10 kinds of people in the world: those who understand binary, and those who don't.
User avatar
toastman
Iron Fist of Justice
Iron Fist of Justice
Posts: 4933
Joined: Sat Nov 10, 2001 3:08 am
Location: New Orleans
Has thanked: 0
Been thanked: 0
Contact:

Post by toastman »

Tangent wrote:He's taking an AP course, yet you tell him to switch majors? As I understand it, AP is high school. He shouldn't even have been able to decide what his major is yet. He definitely should change it, btw, if he can't solve a simple problem like that on his own.

Something doesn't quite add up here.
Not to mention the fact that ssjgoku2135443654754 needed help with it as well.
No signature.
WHurricane16
DC Developer
DC Developer
Posts: 92
Joined: Wed Oct 17, 2001 7:44 pm
Location: Cape Fear Region, NC
Has thanked: 0
Been thanked: 0
Contact:

Post by WHurricane16 »

That's the humor in it all :)
ssj4goku128
Insane DCEmu
Insane DCEmu
Posts: 290
Joined: Wed Oct 17, 2001 7:44 pm
Has thanked: 0
Been thanked: 0

Post by ssj4goku128 »

I did solve it for him, but I was too tired to help him out. I was acting like a total dumbass after getting "releived" of my job.
"So I gotta be carefull, can't let tha evil of tha money trap me
so when ya see me #@#$%
ya better holla at me "

Tupac Shakur[1971-1996]
Makaveli[1996-????]
AmadeusZull
Soul Sold for DCEmu
Soul Sold for DCEmu
Posts: 4085
Joined: Wed Oct 17, 2001 7:44 pm
Location: NYC
Has thanked: 0
Been thanked: 0
Contact:

Post by AmadeusZull »

handjob?
Image

I am no longer an ACE@ite. Never will I kiss his feet is what I don't. And that I don't, is good I do.
Post Reply