my first c++ script
- GeoKureli
-
GeoKureli
- Member since: Apr. 1, 2003
- Offline.
-
- Forum Stats
- Supporter
- Level 19
- Game Developer
i finally made my first c++ program, its nothing special, just a change handler for a vending machine. its an assignment for CIS class. wasn't really that hard, ive already dealt with variables, loops, and operators in flash, and i learned cin/cout like a year ago.
m just wondering if theres anything you don't agree with, or maybe something that could be more efficient, or any bugs i might've missed
btw, im new to the programming forum, im in the flash forum a lot. i know some of the regs here from there
This blog I made | This game sucks | FlxGreed | Home Run Swingers: Rhythm Baseball
many typos
- RageOfOrder
-
RageOfOrder
- Member since: Aug. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
At 11/16/06 12:27 AM, ImpotentBoy2 wrote: i finally made my first c++ program
Your code looks good. The only thing I can suggest, aesthetically, is to drop all your opening braces ( { ) to a new line. It makes a world of difference if you are trying to track down which belong to which, very quickly. Also helps prevent making mistakes in the first place.
- GeoKureli
-
GeoKureli
- Member since: Apr. 1, 2003
- Offline.
-
- Forum Stats
- Supporter
- Level 19
- Game Developer
ya its a habit i made in flash, but visual studio has things on the left side of the code panel that says where brackets start and end, its cool like you can collapse everything iside a bracket to a single line
plus, im kinda weird about how many lines i use, and having a single line just for a { would kill me
This blog I made | This game sucks | FlxGreed | Home Run Swingers: Rhythm Baseball
many typos
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
Good script ^^
Although, you might want to do more inline comments next time.
- GeoKureli
-
GeoKureli
- Member since: Apr. 1, 2003
- Offline.
-
- Forum Stats
- Supporter
- Level 19
- Game Developer
At 11/16/06 01:17 AM, Jordan wrote: Although, you might want to do more inline comments next time.
really? this is already a lot for me
also, i have a question. see im going to school for gaming and simulation programming, and i was wondering what programming language do you think is commonly used for this? i heard c++ is way too laggy to handle something like that.
i know that in order to make gmaes for consoles you need something like xbox's XNA or something, but thats not a language right, thats more of a plug-in or a set of mudules and functions right?
This blog I made | This game sucks | FlxGreed | Home Run Swingers: Rhythm Baseball
many typos
- Jordan
-
Jordan
- Member since: Apr. 23, 2006
- Offline.
-
- Forum Stats
- Member
- Level 14
- Blank Slate
At 11/16/06 01:23 AM, ImpotentBoy2 wrote: really? this is already a lot for me
Yes, when you start to get more advance scripts, you will understand what i mean.
also, i have a question. see im going to school for gaming and simulation programming, and i was wondering what programming language do you think is commonly used for this? i heard c++ is way too laggy to handle something like that.
Actually, C++ is the fastest language you could use for this(Forget about assembly...).
i know that in order to make gmaes for consoles you need something like xbox's XNA or something, but thats not a language right, thats more of a plug-in or a set of mudules and functions right?
That is the DevKit, or libary. You won't have to worry about that too much at the moment, because when you do get a job working for a console game development buisness, they will provide all DevKits and libaries for you. And they cost alot, if you want to buy one on your own.
- GeoKureli
-
GeoKureli
- Member since: Apr. 1, 2003
- Offline.
-
- Forum Stats
- Supporter
- Level 19
- Game Developer
At 11/16/06 01:32 AM, Jordan wrote: Yes, when you start to get more advance scripts, you will understand what i mean.
i see where your coming from.
Actually, C++ is the fastest language you could use for this(Forget about assembly...).
actually, i heard assembly was probly the one to do it in, but i had doubts, and you confirmed those doubts. supposedly assembly is a step above machine language.
That is the DevKit, or libary. You won't have to worry about that too much at the moment, because when you do get a job working for a console game development buisness, they will provide all DevKits and libaries for you. And they cost alot, if you want to buy one on your own.
me and a few people formed a group and were gonna do something with it for our final project. and no no one expects it tobe easy
This blog I made | This game sucks | FlxGreed | Home Run Swingers: Rhythm Baseball
many typos
- dELtaluca
-
dELtaluca
- Member since: Apr. 16, 2004
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
At 11/16/06 01:38 AM, ImpotentBoy2 wrote:Actually, C++ is the fastest language you could use for this(Forget about assembly...).actually, i heard assembly was probly the one to do it in, but i had doubts, and you confirmed those doubts. supposedly assembly is a step above machine language.
as far as i know, assembly is a direct translation of machine language
001100110110000111001 becomes MOV a, b or whatever, (something like that)
- dELtaluca
-
dELtaluca
- Member since: Apr. 16, 2004
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
oh and if youre worried about wasting lines in your code, just dont use braces at all when its a single statement like yours are, its perfectly leggible, and saves space
if(coins > 1){
cout << " dollars, ";
} else {
cout << " dollar, ";
}
becomes
if(coins>1)
cout << " dollars, ";
else
cout << " dollar, ";
- GeoKureli
-
GeoKureli
- Member since: Apr. 1, 2003
- Offline.
-
- Forum Stats
- Supporter
- Level 19
- Game Developer
right, i totally forgot about that. im probably gonna get used to doing that, since flash 9 has no autoformat.
This blog I made | This game sucks | FlxGreed | Home Run Swingers: Rhythm Baseball
many typos
- elbekko
-
elbekko
- Member since: Jul. 23, 2004
- Offline.
-
- Forum Stats
- Member
- Level 16
- Blank Slate
If you'd try to develop a game in Assembly, it'd take you ages to make Pong =/
Really, C++ (with the neccesary optimizing) is one of the best languages for making games :)
"My software never has bugs. It just develops random features. " - Unknown
[ FluxBB developer | Quickmarks 0.5.1 | Strings & Ints - my blog ]
- dELtaluca
-
dELtaluca
- Member since: Apr. 16, 2004
- Offline.
-
- Forum Stats
- Member
- Level 20
- Blank Slate
At 11/16/06 09:46 AM, ImpotentBoy2 wrote: right, i totally forgot about that. im probably gonna get used to doing that, since flash 9 has no autoformat.
i havnt used autoformat in years, its much nicer being able to organize youre code how you like
- thoughtpolice
-
thoughtpolice
- Member since: Mar. 24, 2003
- Offline.
-
- Forum Stats
- Member
- Level 10
- Blank Slate
At 11/16/06 10:17 AM, elbekko wrote: If you'd try to develop a game in Assembly, it'd take you ages to make Pong =/
Lies. You could make pong in very little time and code with a good, modern assembler. Not that hard, you can even do OpenGL-based programming in something like NASM pretty easily.
omg.
Playstation Network tag: muffin-noodle
the empty set
- GeoKureli
-
GeoKureli
- Member since: Apr. 1, 2003
- Offline.
-
- Forum Stats
- Supporter
- Level 19
- Game Developer
i changed it around, just to kinda test myself
http://pastebin.com/825965
also i noticed a glitch thats been there since the first code i gave
sometimes it just leaves out a penny.
im sure it has something do with converting it to an integer datatype because if you pay 1 penny more then the items price it says your change is .999....
This blog I made | This game sucks | FlxGreed | Home Run Swingers: Rhythm Baseball
many typos
- seel
-
seel
- Member since: Jun. 27, 2005
- Offline.
-
- Forum Stats
- Member
- Level 21
- Musician
At 11/16/06 10:17 AM, elbekko wrote: If you'd try to develop a game in Assembly, it'd take you ages to make Pong =/
That all depends on what ASM you use. I made a pong in ASM 6502 (NES homebrew). It only took 5 days. And belive it or not, but ASM 6502 is extremely easy and it's extremely old. I'm not familiar with any version of ASM that would be so time consuming it'd take more than 7 days to make a pong game.
- elbekko
-
elbekko
- Member since: Jul. 23, 2004
- Offline.
-
- Forum Stats
- Member
- Level 16
- Blank Slate
I find 5-7 days for pong quite long actually :P Especially if you see what more would be needed to make an RPG or FPS =/
"My software never has bugs. It just develops random features. " - Unknown
[ FluxBB developer | Quickmarks 0.5.1 | Strings & Ints - my blog ]
- GeoKureli
-
GeoKureli
- Member since: Apr. 1, 2003
- Offline.
-
- Forum Stats
- Supporter
- Level 19
- Game Developer
thats all cool and everything, but peole are losing pennies here
This blog I made | This game sucks | FlxGreed | Home Run Swingers: Rhythm Baseball
many typos
- Mister-Mind
-
Mister-Mind
- Member since: Jul. 1, 2006
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
Congrads on making your first script. I remember when I had made my first calculator.
- GeoKureli
-
GeoKureli
- Member since: Apr. 1, 2003
- Offline.
-
- Forum Stats
- Supporter
- Level 19
- Game Developer
This blog I made | This game sucks | FlxGreed | Home Run Swingers: Rhythm Baseball
many typos
- amaterasu
-
amaterasu
- Member since: Mar. 7, 2004
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 11/16/06 03:29 PM, elbekko wrote: I find 5-7 days for pong quite long actually :P Especially if you see what more would be needed to make an RPG or FPS =/
That's a lot less than "ages," however.
beep

