Translate pseudocode

Feb 6, 2010 at 7:09am
I am a beginner and I'm looking to translate this pseudocode into a valid C++ code. Any help would be greatly appreciated. Thanks in advance, Angel.

set valid_flag to 1
if (balance >= 0)
set balance_hold to balance
display balance
else
set valid_flag to 0
endif
Feb 6, 2010 at 7:17am
show use your code first.. we'll help you with your errors!

this site is a very good reference..
http://cplusplus.com/doc/tutorial/

you gotta read the basics of c++
Feb 6, 2010 at 7:20am
closed account (j3bk4iN6)
1
2
3
4
5
6
7
8
9
10
11
12
while(flag !=0)
{
       if(balance >= 0)
       {
              balance_hold = balance;
              cout << balance;
        }
        else
        {
                flag = 0;
        }
} 

is all I could get
Last edited on Feb 6, 2010 at 7:22am
Feb 6, 2010 at 9:37am
there is no loop in the pseudo code..
Feb 6, 2010 at 10:00am
1
2
3
4
5
6
7
8
9
10
int valid_flag = 1;
if (balance >= 0)
{
balance_hold = balance;
cout<< balance;
}
else
{
 valid_flag = 0;
}
Feb 6, 2010 at 10:45pm
Wow! Thanks guys. I took this class cause I find coding fascinating. Then I started the class and realized I would have to join a community to be the best coder I could be. But I didn't expect help this fast. You guys are very generous and I look forward to being a part of this site, if you guys don't mind, for a very long time. I love this stuff.
Thanks for the help, Angel.
Feb 6, 2010 at 10:50pm
Please don't expect us to help you on your homework next time.

abilify--
Jesuss--
Feb 6, 2010 at 10:55pm
abilify-- especially because his code is wrong.
So it's more... --abilify--.
Feb 6, 2010 at 11:42pm
--abilify--


ROFL
Feb 7, 2010 at 12:53am
C'mon guys its the second and its an exercise in the text book I wanted to do. Just practicing.
Now I remember why I walked around knocking people the fuck out for no reason. You guys are idiots.
Feb 7, 2010 at 12:57am
closed account (j3bk4iN6)
How are you suppose to interpret somebody elses psuedocode when you don't know what that psuedocode is because you didn't write it, if your so smart than look and see why my version works, idiot chrisname.
Feb 7, 2010 at 1:02am
TEODOE: I can see why you'd be upset, but you have to keep in mind that this forum has a daily influx of idiots who only care about passing grades and will shamelessly ask others to do their homework for them.
Just take a look at this moron: http://www.cplusplus.com/forum/beginner/19231/
We get things like that every day. At this point, we automatically assume that if someone asks for help in finishing something without giving much detail that they don't want to do their own homework. Maybe we shouldn't do that but, after a while, it becomes a reflex.
Feb 7, 2010 at 1:07am
closed account (j3bk4iN6)
also, flag should be a good indicator.
Feb 7, 2010 at 1:15am
helios wrote:
Maybe we shouldn't do that but, after a while, it becomes a reflex.


Shouldn't ??? I think we should!, doing work for people does not help them learn, and people who don't want to learn should not pass.
Pffft, I don't want that guy working on bridges and tunnels and things people depend on to work without falling down around them. He says he's a pro at engineering, There's a very good reason WHY they teach programming in engineering courses. IMO he has no idea what engineering is and is probably failing that as well...
Feb 7, 2010 at 1:31am
closed account (j3bk4iN6)
valid_flag, come on, why would you need a valid_flag unless it was used for a while loop, if flag is valid then continue, else break.
Feb 7, 2010 at 1:35am
why would you need a valid_flag unless it was used for a while loop
There's so many reasons, I can't even begin to list them.
For example:
1
2
3
4
class Program{
    bool valid;
    //...
};
Feb 7, 2010 at 1:38am
closed account (z05DSL3A)
chrisname and DrChill just grow up. There is no need to but in after the fact and start insulting people.
Feb 7, 2010 at 1:42am
closed account (j3bk4iN6)
I like this forum because I learn alot more than whats in the book, I'll just stop trying to answer people because I don't know enough, but people aren't going to discourage me to just give up. If all you do is insult people because they try to figure something out, then you all will have a forum left full of yourselves and people that only use you for answering their class exercises. Why are you in the beginners forum if you know so much. Get a job. Isn't it time to move on, because chrisname I don't want your help, because your a little jerk.
Last edited on Feb 7, 2010 at 2:00am
Topic archived. No new replies allowed.