Translate pseudocode

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
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++
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
there is no loop in the pseudo code..
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;
}
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.
Please don't expect us to help you on your homework next time.

abilify--
Jesuss--
abilify-- especially because his code is wrong.
So it's more... --abilify--.
--abilify--


ROFL
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.
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.
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.
closed account (j3bk4iN6)
also, flag should be a good indicator.
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...
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.
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;
    //...
};
closed account (z05DSL3A)
chrisname and DrChill just grow up. There is no need to but in after the fact and start insulting people.
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
Topic archived. No new replies allowed.