We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
  • 3
C/C++ Discussion
Topic Started: Sep 17 2008, 09:05 PM (2,065 Views)
FinalKiller0
Member Avatar
OVER 1,000!!
[ *  *  *  *  * ]
mcteeth
Sep 22 2008, 03:18 PM
"FinalKiller0"
 
This would Hello World IMO:

Take care though: iostream.h has been deprecated since < 1996 and main() returning void is considered harmful.
Well, I have only been programming in my programming class, and the compiler we use is Turbo C++ 3.0, which is older than me and everyone else in my class, so I am not really with the times right now.

It's just that my computer science teacher is big on using functions only when you want to return a value, and void for everything else.
Offline Profile Quote Post Goto Top
 
Viral.
Member Avatar
Member
[ *  *  *  *  *  * ]
Fission
Sep 21 2008, 09:11 PM
C++ is sort of easy to get the hang of if you know the basics of programming. "Hello world" example for C++, with comments:

Code:
 

// preprocessor command
// " " includes from program directory, < > includes from compiler's include directory
#include <iostream> // input/output library
using namespace std; // not required, but should always be used, from my experience

int main(int i, char **c) { // the beginning of main(), the central function for a C program.
// the two parameters are standard with a few libraries, such as SDL, but are not required.

cout << "Hello world!"; // bitshifts "Hello world" to cout, which is a variable that holds the output for a standard C DOS-like window
// prints "Hello world!"

system("pause"); // wait for input before continuing
return 0; // end the program.
}


If you want, I can make a simple tutorial on C++ basics in here, my blog on this board, or through PM.
That would be great :O , I just need to keep trying to install a C++ compiler.
Offline Profile Quote Post Goto Top
 
FinalKiller0
Member Avatar
OVER 1,000!!
[ *  *  *  *  * ]
Well, my quick sort program worked out of luck (80% of the time it worked, and it didn't the other 20%).

We are now going to start learning object oriented programming!

And my teacher said that he is going to start looking for a new license the school can use for C++ programming (we currently use an outdated compiler, Turbo C++ 3.0). He said he is going to try to get something with GUI. The number one thing he needs the compiler to do is not have a string data type.
Edited by FinalKiller0, Sep 24 2008, 05:07 PM.
Offline Profile Quote Post Goto Top
 
Tim-ZNS
Member Avatar
I used to be green.
[ *  *  *  *  * ]
I've got a few C++ books and know the basics. They all go as far as input/output, but I'm not sure where to go next. I would like to get some qt programming working, but it doesn't seem to work for me at the moment.
Could someone tell me a good place to go next?
Offline Profile Quote Post Goto Top
 
FinalKiller0
Member Avatar
OVER 1,000!!
[ *  *  *  *  * ]
So I pretty much got the basics of object oriented programming. My last program involved reading in, parsing, sorting, and outputting quotes using a template bubble sort, a class that helped with sort and such, header files, and input/output w/ txt files.

Now we have started the checkers program. So far, we are only working on creating algorithms with classes to create a board and set up the pieces. It is not hard at all, but it isn't as easy as one may think.
Edited by FinalKiller0, Oct 23 2008, 08:36 PM.
Offline Profile Quote Post Goto Top
 
mcteeth
Member Avatar
Oh, Comely.
[ *  * ]
How's the compiler situation going?

Quote:
 
I've got a few C++ books and know the basics. They all go as far as input/output, but I'm not sure where to go next.

C++ is an incredibly large language with an equally large number of quirks. If you're interested in digging deeper, it's worth keeping C++ FAQ Lite on hand -- very good source of information. As a companion, you can also read C++ Frequently Questioned Answers which lists several problems with C++ (it brings up a lot of good points, but the tone might bother some people).
Offline Profile Quote Post Goto Top
 
FinalKiller0
Member Avatar
OVER 1,000!!
[ *  *  *  *  * ]
Oh yay, I figured out how to use graphics.h; too bad that it is too late for me to implement it in my program.

I put "NC State!" in like 32x32 font and red, and then had it written just like that again, except the words were vertical (tilted pi/2), and the space was aligned with the space in my previous statement.


Oh, and I forgot to mention that our teacher threatens us if we use his/NCSU's rival school's , UNC's, colors, he will fail us. I did use some cyan in there (light blue is UNC color), but I like it and didn't want to switch it with something else. I hope he doesn't fail me. :P
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply
  • Pages:
  • 1
  • 3