Staredit Network > Forums > Technology & Computers > Topic: C++ Programming
C++ Programming
Jun 25 2012, 12:28 am
By: luzz  

Jun 25 2012, 12:28 am luzz Post #1



Not sure if this goes here, but the description on the forum said "Anything and everything geek" and I think this counts as part of geekiness.

What I would like to do is learn how to use the C++ programming language. I have read some articles on it already, and have some sample code that someone made for me (That I don't understand at all, and if I do its only miniscule parts of the whole that he made). What I would like to do with this knowledge is

1. Make an iPhone app so I can get some cash, xD (I think xcode uses C++, or I have been told it does)
2. Try to make an AI for the AI contest someone posted about, I don't really want to win, I just think it would be cool to make an AI and watch it either own or lose to the other AI.

I am very bad at line by line code programming unless I have like... a manual about commands that can be used. This is why I find the SC2 editor to be so easy, is because it has templates that you use instead of raw code which makes it a lot simpler. This is also why C++ is so hard for me. There is no list of commands that can be used, or actions that can be implemented. My knowledge of any of them is little to none, which doesn't help when I am trying to make something complex.

I know there are a few adept programmers on this site, and I would like to learn how to do a few things by myself, so I don't rely fully on google, which can sometimes be a huge letdown.

So lets start with something simple, for both of my projects.

1. How do I make a button for an iPhone app, that when i tap it, brings me to another screen (View), that is like... red instead of blue, and then another button on the next screen that takes me back to the previous one.

2. I have downloaded the Basic AI module, and it makes plenty of units, but it doesn't send them anywhere, and I don't know how to make the AI send them somewhere. So what I would like to learn how to do, is just make my Terran AI mount an attack at like... 4 minutes in. Is this possible? I hope so xD

Any help on any of these subjects would be extremely helpful, thank you for any assistance you give! =)



None.

Jun 25 2012, 12:48 am lil-Inferno Post #2

Just here for the pie

While written for game programming, this wonderful article gives a good deal of information about general learning of a programming language as well as both free and commercial resources for going about doing so. It also talks about why you should not use C++ as a beginning language, which you may want to take into consideration.

http://www.gamefromscratch.com/post/2011/08/04/I-want-to-be-a-game-developer.aspx

Also you say you want to make some money. It'll take you a while. You probably will make little, if any, money when you're just starting but keep at it and the rewards will be glorious. :D

Post has been edited 1 time(s), last time on Jun 25 2012, 12:54 am by lil-Inferno.




Jun 25 2012, 12:51 am Roy Post #3

An artist's depiction of an Extended Unit Death

Quote from luzz
Not sure if this goes here, but the description on the forum said "Anything and everything geek" and I think this counts as part of geekiness.
This is the perfect place for your topic!

Quote from luzz
1. Make an iPhone app so I can get some cash, xD (I think xcode uses C++, or I have been told it does)
If you want to make apps for iOS, you'll probably want to learn a different language, like Objective-C. C++ is (apparently) possible for iOS apps, but I can't imagine it being too easy. I, myself, am currently looking into Mono for mobile development.

Quote from luzz
2. Try to make an AI for the AI contest someone posted about, I don't really want to win, I just think it would be cool to make an AI and watch it either own or lose to the other AI.
Heinermann posted about it here, but you can only participate if you're currently a student.

Quote from luzz
I am very bad at line by line code programming unless I have like... a manual about commands that can be used. This is why I find the SC2 editor to be so easy, is because it has templates that you use instead of raw code which makes it a lot simpler. This is also why C++ is so hard for me. There is no list of commands that can be used, or actions that can be implemented. My knowledge of any of them is little to none, which doesn't help when I am trying to make something complex.
A lot of IDEs have some form of auto-complete, which can make programming much easier than, say, typing in notepad.

Quote from luzz
I know there are a few adept programmers on this site, and I would like to learn how to do a few things by myself, so I don't rely fully on google, which can sometimes be a huge letdown.
Here's your new friend: http://stackoverflow.com/

Quote from luzz
2. Try to make an AI for the AI contest someone posted about, I don't really want to win, I just think it would be cool to make an AI and watch it either own or lose to the other AI.
I assume you're using BWAPI? You can find documentation on its Wiki. For example, to order a unit to attack, you'd call the function:
attack(Unit* unit, Position target, bool shiftQueueCommand = false);


I would be more specific if I was more familiar with C++ and BWAPI. I've been meaning to learn C++ myself (I'm only familiar with Java and C#), but haven't had the time.

Edit:
Quote from lil-Inferno
It also talks about why you should not use C++ as a beginning language, which you may want to take into consideration.
Yeah, I'd start with Java (but I'm just saying that because I started with Java).




Jun 25 2012, 1:01 am IskatuMesk Post #4

Lord of the Locker Room

I have been recommended to start with C by many experienced programmers, by which then you would be more prepared to use C++ afterwards. But I'm incompetent so I have no hope of learning either. Good luck!



Show them your butt, and when you do, slap it so it creates a sound akin to a chorus of screaming spider monkeys flogging a chime with cacti. Only then can you find your destiny at the tip of the shaft.

Jun 25 2012, 1:52 am Lanthanide Post #5



Sounds like you need to read some programming books that teach you the language.

I've never really used python for anything at all, and now we're using it at work to write some test scripts. It's similar to C, but also different enough that the differences can trip you up. The correct approach would be for me to sit down and read a python book and learn the actual language, but because so far the impact on my work has been very minimal it's been easier just to splash around, make a mess and consult google when anything confusing or different crops up.

Long story short: if you want to use a language for the long haul, you're going to be best served by getting a proper foundation in it, ideally from a programming course or failing that from a book (don't believe the "learn programming in 21 days" books, that's a load of crap, it's the same as "learn to be a mechanic in 21 days"). You can jump in and start playing around, but you really won't be learning it 'properly' and there'll be a lot of stuff that you just don't know. At uni when we did computer science with courses on languages (C, Java), they said there's a small subset of the class who they have to get to forget all the stuff they self-taught themselves because it's almost always wrong in many substantial ways and then build them back up from the foundations with a proper understanding of what's going on.



None.

Jun 25 2012, 3:55 am luzz Post #6



Ok thank you very much guys.

To Roy, you answered all of my questions perfectly

1. Stackoverflow... I have seen this website when I google for programming questions, and it has been quite helpful. I don't know I'd any of you know what Xcode is, but it is the iOS programming tool used by Mac developers, and I believe it uses the C++ language (I may be wrong) this is why I want to jump straight into C++, the amount of money used buying selling apps on the iPhone is tremendous, all I wanted to do was make a small app at first for free to see how people like it, then slowly build up. I know how to make functional buttons, and table views, and tabs. But my knowledge is extremely limited, even in this aspect.

2. I have looked at the BWAPI Wiki, but it doesn't show how to implement it, like the targets that you can order your units to attack, or how to select different enemy units (like to focus down medics or tanks), the amount of tutorials for beginners just seems to be lacking. Also, I'm a junior in high school, does this make me count as a student? Or do I need to be in college? I would still like to try and program nonetheless.

All in all, the 2 things I want to make involve c++ (Which is terrible apparently :( ), and I still want to continue. So what is the difference between C and C++, Roy you said once that C++ is just C with classes, what does that mean? I need to start with the basics and work my way up to the top. Oh and I'm pretty good at math, all I need to learn is a few commands and how to implement them.

I also have Quite a few books on Xcode programming, but they are very limited and don't tell me what I reall need to do or want to do, they are also outdated and are nigh on useless except for a few things now.

So let's see, I have been wanting to test my abilities at making things by making a "Find me" type game for the iOS. It would have 4 pictures that you can slide over to, each with a different thing you had to find, and the thing you needed to find would be written at the top of the screen. Does this sound too complex? I think the only hard part would be making a label at the top change based on what you are trying to find, and have it carry through to each view.

Question Roy, is C# and C++ similar in any way? If I can figure out how to make the app I mentioned above, I'll post some sample code for you to compare to if you need it.

To Lil-Inferno, thanks for the link I'll look into it, but I still want to learn C++... The things I want to use don't use any language other than C++ I'm pretty sure, and I have dabbled a bit in Java as well.

Oh and Xcode is apples official iOS programming software for the Mac, just if you guys didn't know, and it uses C++, that's why I don't want to learn a different language first :/



None.

Jun 25 2012, 4:00 am Jack Post #7

>be faceless void >mfw I have no face

I'm fairly sure xcode uses objective C, which is similiar to C++ but not the same. I could be wrong, it's been a while since I looked at iOS coding.

C is very similiar to C++; C++'s classes are the main difference. To find out about classes, I suggest you read up about object-oriented programming (OOP) on the googley.



Red classic.

"In short, their absurdities are so extreme that it is painful even to quote them."

Jun 25 2012, 4:08 am Lanthanide Post #8



Quote from Jack
C is very similiar to C++; C++'s classes are the main difference. To find out about classes, I suggest you read up about object-oriented programming (OOP) on the googley.
That's like saying a skyscraper is very similar to a house, the main difference is the number of windows.



None.

Jun 25 2012, 5:05 am Sand Wraith Post #9

she/her

I'd say just learn C++. I don't see what's so difficult about it. Just make sure to pay attention to whatever you're doing if you're going to do anything involving memory I guess. (Although maybe I shouldn't say this because I rarely program anything that requires effort on my part to manage memory LOL.)

Quote
small subset of the class who they have to get to forget all the stuff they self-taught themselves because it's almost always wrong in many substantial ways and then build them back up from the foundations with a proper understanding of what's going on.

(if I get into my program of choice) hi




Jun 25 2012, 6:10 am Vrael Post #10



If you want to start with C++, start with C++. The only reason people recommend something else is because C++ is complex. In my opinion its better to learn and understand the nuts and bolts of programming and understand how they affect and interact with things like the operating system, than it is to merely be able to use the language. By analogy, if you wanted to build an engine for a car, its one thing to know you need a transmission and some belts and some cooling fluid and some cylinders, but another thing altogether to know how the gas injected into the cylinder explodes and causes the pressure which forces the whole thing to work, and how the transmission can modify the power and torque being output to the wheels and such and such. The guy who understands the whole engine is going to be a better mechanic, and the programmer who understands how and why the language works will be a better programmer.

That said, C++ isn't the only programming language in the world for a reason. Namely, other languages are constructed in a way to be better suited for their own tasks, whether its 10 times easier to write in them, or maybe they're adapted for a particular operating system, etc.



None.

Jun 25 2012, 6:20 am Lanthanide Post #11



Frankly I find the syntax of C++ confusing and hard to follow. That by itself is a reason not to start with C++. Better to start with something to get the concepts down; then you can get over the syntax hurdle of C++ once you work out what it's trying to do.



None.

Jun 25 2012, 11:01 am Jack Post #12

>be faceless void >mfw I have no face

Quote from Lanthanide
Quote from Jack
C is very similiar to C++; C++'s classes are the main difference. To find out about classes, I suggest you read up about object-oriented programming (OOP) on the googley.
That's like saying a skyscraper is very similar to a house, the main difference is the number of windows.
No, it's like saying C is very similar to C++, the main difference is that C++ is object-oriented; the most obvious result of this is classes.



Red classic.

"In short, their absurdities are so extreme that it is painful even to quote them."

Jun 25 2012, 1:25 pm Roy Post #13

An artist's depiction of an Extended Unit Death

Quote from luzz
2. I have looked at the BWAPI Wiki, but it doesn't show how to implement it, like the targets that you can order your units to attack, or how to select different enemy units (like to focus down medics or tanks), the amount of tutorials for beginners just seems to be lacking. Also, I'm a junior in high school, does this make me count as a student? Or do I need to be in college? I would still like to try and program nonetheless.
I'm not sure if you qualify, but I don't see why you wouldn't. Also, on the site are complete example AIs that you can look at. If you're a learn-by-example kind of person, you can look through the source code and see how they handle it.

Quote from luzz
So what is the difference between C and C++, Roy you said once that C++ is just C with classes, what does that mean? I need to start with the basics and work my way up to the top. Oh and I'm pretty good at math, all I need to learn is a few commands and how to implement them.
Yeah, that's more of an oversimplification. I regard C++ as basically C with a few additions, such as support for Object-Oriented Programming (OOP), which is a design paradigm to help keep your code organized and non-procedural. Some people (*cough*Farty*cough*) don't see any value in OOP, but I advocate it if you're going to be working on any reasonably-sized project, as it makes the code much easier to conceptualize and understand (among other reasons).

And, you may be shocked to find this out, but you don't really need to be good at math to be good at programming. Programming is very logic-oriented, and unless you're programming something to do with math, you don't go into anything more complex than addition, subtraction, multiplication, division, and modulus.

Quote from luzz
Question Roy, is C# and C++ similar in any way? If I can figure out how to make the app I mentioned above, I'll post some sample code for you to compare to if you need it.
Hardly. C# is more closely related to Java than C++. Java and C# both have memory management (garbage collecting), built-in GUI libraries (Swing and WinForms/WPF respectively), and similar syntax. For C++, you have to do your own memory management, find or make your own GUI library, and has different syntax (more akin to C, which it was built upon). C++ can also be optimized to perform much quicker than C# and Java because it is a lower-level language. Technically, in C# you can code in "unsafe" blocks, which allows you to use pointers and avoid various compiler checks to make it more optimized (I did this for a Bitmap object in an Optical Character Recognition program once to get faster times).

I find C# to be much easier to work with, especially when handling collections.

Quote from luzz
To Lil-Inferno, thanks for the link I'll look into it, but I still want to learn C++... The things I want to use don't use any language other than C++ I'm pretty sure, and I have dabbled a bit in Java as well.
You can code iOS applications in lots of different languages, and you can make calls to an API in almost language (just you couldn't enter the competition if you used a language other than C++).

Post has been edited 1 time(s), last time on Jun 25 2012, 1:31 pm by Roy.




Jun 25 2012, 2:42 pm luzz Post #14



The only problem is, I don't know of any other way to program for apples iOS system that doesn't use xcode... also, heres what apple says about Xcode

Quote
The same parser used to build C/C++ and Objective-C powers Xcode’s indexing engine, providing incredibly accurate code completions.

Does this mean that Xcode uses a mix of all these different languages? I know that Xcode is object oriented programming, because it has a cool little interface in which you can design your different views and set up the buttons to react with the code you have written, but I don't know what the mixing of all these languages means. Does it mean that Xcode can address a wider view of challenges, and still execute each one seamlessly because it has 3 languages to call on instead of just 1?

Meh, I need to figure out the apple website, its so confusing.



None.

Jun 25 2012, 2:51 pm lil-Inferno Post #15

Just here for the pie

Quote from luzz
The only problem is, I don't know of any other way to program for apples iOS system that doesn't use xcode... also, heres what apple says about Xcode

Quote
The same parser used to build C/C++ and Objective-C powers Xcode’s indexing engine, providing incredibly accurate code completions.

Does this mean that Xcode uses a mix of all these different languages? I know that Xcode is object oriented programming, because it has a cool little interface in which you can design your different views and set up the buttons to react with the code you have written, but I don't know what the mixing of all these languages means. Does it mean that Xcode can address a wider view of challenges, and still execute each one seamlessly because it has 3 languages to call on instead of just 1?

Meh, I need to figure out the apple website, its so confusing.
It means that XCode supports C++, C, Objective-C (and more) source code.




Jun 25 2012, 9:15 pm Lanthanide Post #16



Quote from Jack
Quote from Lanthanide
Quote from Jack
C is very similiar to C++; C++'s classes are the main difference. To find out about classes, I suggest you read up about object-oriented programming (OOP) on the googley.
That's like saying a skyscraper is very similar to a house, the main difference is the number of windows.
No, it's like saying C is very similar to C++, the main difference is that C++ is object-oriented; the most obvious result of this is classes.
Restating your original claim doesn't make it any less wrong.

Yes, C++ has classes, because it is OO. That by itself makes it a vastly, hugely different beast from C. As in, if you are programming in C++ for any large project, and you do it properly, it will look vastly different from the same program written in C. The problems you encounter in C++ are also of a different nature than those you encounter in C. But hey, I just program in C for a living, what do I know?

Post has been edited 1 time(s), last time on Jun 25 2012, 9:21 pm by Lanthanide.



None.

Jun 25 2012, 10:36 pm Jack Post #17

>be faceless void >mfw I have no face

Quote from Lanthanide
Quote from Jack
Quote from Lanthanide
Quote from Jack
C is very similiar to C++; C++'s classes are the main difference. To find out about classes, I suggest you read up about object-oriented programming (OOP) on the googley.
That's like saying a skyscraper is very similar to a house, the main difference is the number of windows.
No, it's like saying C is very similar to C++, the main difference is that C++ is object-oriented; the most obvious result of this is classes.
Restating your original claim doesn't make it any less wrong.

Yes, C++ has classes, because it is OO. That by itself makes it a vastly, hugely different beast from C. As in, if you are programming in C++ for any large project, and you do it properly, it will look vastly different from the same program written in C. The problems you encounter in C++ are also of a different nature than those you encounter in C. But hey, I just program in C for a living, what do I know?
I don't especially want to argue over this, but the languages themselves, with regards to syntax particularly, are extremely similar, with most of C++'s differences coming from thefact that is OOP. As you said, that makes it a different beast, but that is the single major difference, and you'd have to be ignorant of the languages to argue that there is another difference between the two languages that is bigger than OOP, that is not caused by OOP.



Red classic.

"In short, their absurdities are so extreme that it is painful even to quote them."

Jun 25 2012, 11:12 pm luzz Post #18



Ok so, we have established that C++ is OO, and that Xcode uses both C++, Objective-C, and C languages, which should make my question all that much easier, does anyone here have Xcode? If you use C, or any of the previously mentioned languages you can help me a ton. =)

If you need some sampler code to compare, please just ask. But what I want is some examples to work off of. Like if someone knows that a program they have made works with the iOS engine, and they have the code for it they can post it on here. This forum is all about expanding the knowledge base of anyone who wants to learn about it. Thats basically what I wanted to do. No need to fight over what kinds of beasties C and C++ are, so please help xD



None.

Jun 25 2012, 11:21 pm lil-Inferno Post #19

Just here for the pie

Quote from luzz
Ok so, we have established that C++ is OO, and that Xcode uses both C++, Objective-C, and C languages, which should make my question all that much easier, does anyone here have Xcode? If you use C, or any of the previously mentioned languages you can help me a ton. =)

If you need some sampler code to compare, please just ask. But what I want is some examples to work off of. Like if someone knows that a program they have made works with the iOS engine, and they have the code for it they can post it on here. This forum is all about expanding the knowledge base of anyone who wants to learn about it. Thats basically what I wanted to do. No need to fight over what kinds of beasties C and C++ are, so please help xD
You're probably better off using Google. As far as I know SEN has no iPhone developers.




Jun 25 2012, 11:44 pm CecilSunkure Post #20



If you want to write for the iPhone use the iPhone SDK. You'll require access to a Mac in order to do so.

There's also the newer option of creating a flash game. Due to the release of Stage 3D you can offload work to the GPU, which can greatly increase efficiency of a flash application. You can also develop flash applications for free using Flash Develop.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:53 pm]
Oh_Man -- https://youtu.be/MHOZptE-_-c are yall seeing this map? it's insane
[2024-5-04. : 1:05 am]
Vrael -- I won't stand for people going around saying things like im not a total madman
[2024-5-04. : 1:05 am]
Vrael -- that's better
[2024-5-04. : 12:39 am]
NudeRaider -- can confirm, Vrael is a total madman
[2024-5-03. : 10:18 pm]
Vrael -- who says I'm not a total madman?
[2024-5-03. : 2:26 pm]
UndeadStar -- Vrael, since the ad messages get removed, you look like a total madman for someone that come late
[2024-5-02. : 1:19 pm]
Vrael -- IM GONNA MANUFACTURE SOME SPORTBALL EQUIPMENT WHERE THE SUN DONT SHINE BOY
[2024-5-02. : 1:35 am]
Ultraviolet -- Vrael
Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
Gonna put deez sportballs in your mouth
[2024-5-01. : 1:24 pm]
Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
[2024-4-30. : 5:08 pm]
Oh_Man -- https://youtu.be/lGxUOgfmUCQ
Please log in to shout.


Members Online: Roy, jun3hong