need ideas

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

killercoder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 29
Joined: Sat Oct 17, 2009 4:19 pm

need ideas

Post by killercoder »

I need some new ideas for a program to try coding as a beginner in the c++ language, I ask this because I cant think of anything to code. I would like simple ideas because I am fairly new to programming with c++ and I have been having a hard time to try to code something that will test my abilities so far.

p.s. Thank you very much for any and all ideas they are greatly appreciated :)
User avatar
Trask
ES Beta Backer
ES Beta Backer
Posts: 738
Joined: Wed Oct 29, 2008 8:17 pm
Current Project: Building a 2D Engine
Favorite Gaming Platforms: Sega Genesis and Xbox 360
Programming Language of Choice: C/C++
Location: Pittsburgh, PA
Contact:

Re: need ideas

Post by Trask »

I recommend going through some tutorials, not sure how 'beginner' you really are, but I do know that learning some new feats of the language always gave me ideas of things to try as I would better understand or have an idea on how something was made to begin with.
MarauderIIC wrote:You know those people that are like "CHECK IT OUT I just made Linux run on this piece of celery [or other random object]!!"? Yeah, that's Falco, but with ES.
Dear god, they actually ported ES to a piece of celery!
Martin Golding wrote: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
User avatar
Pennywise
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 55
Joined: Tue Sep 22, 2009 1:36 pm
Favorite Gaming Platforms: Megadrive(Genesis), Dreamcast, SNES, Nintendo 64
Programming Language of Choice: C, C++ and Java
Location: England

Re: need ideas

Post by Pennywise »

A good one can be a program that asks for your age, and says whether your a child, adult or whatever using if and else statements (or switch statements).
killercoder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 29
Joined: Sat Oct 17, 2009 4:19 pm

Re: need ideas

Post by killercoder »

Yea that is a good idea :)

I think I am going to try that :p
User avatar
Pickzell
Chaos Rift Junior
Chaos Rift Junior
Posts: 233
Joined: Sat May 16, 2009 10:21 am

Re: need ideas

Post by Pickzell »

Building off of Pennywise's idea:

Base your programs off of real life.

I currently don't have a compiler so don't hate me if there are errors.

Code: Select all

//This gives you good advice
#include <iostream>

using namespace std;

unsigned short int grade;

int main()
{

   cout << "Enter your grade!";
   cin >> grade;

   //I don't like switch statements :p
   if( grade > 100 )
      cout << "Lying gets you nowhere";
   else if( grade >= 90 && grade <= 100 )
      cout << "You're better than me";
   else if( grade >= 80 && grade < 90 )
      cout << "What does the B stand for?";
   else if( grade >= 70 && grade < 80 )
      cout << "It means average, believe it or not";
   else if( grade >= 60 && grade < 70 )
      cout << "Remember, it's your teacher's fault.";
   else if( grade >= 50 && grade < 60 )
      cout << "It stands for fantastic. Srsly.";
   else
      cout << "Stop drinking on school nights.";

cin.get();
return 0;
}
I'm an altogether bad-natured Cupid.
K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: need ideas

Post by K-Bal »

You can also dive into game programming, write a "Guess the Number" game ;)
User avatar
zeid
Chaos Rift Junior
Chaos Rift Junior
Posts: 201
Joined: Fri Apr 24, 2009 11:58 pm

Re: need ideas

Post by zeid »

A good tutorial regime for someone looking to be a games programmer might be something like:

Absolute beginner
  • Basic data types; int, bool, float, double, char
  • Arrays and Strings.
  • Input and Output.
  • Selection.
  • Iteration.
  • Methods/Functions.
Don't just do these things one way either try and see how many different ways you can go about things. With selection learn if statements, if else statements, switch statements and ?:;. With iteration learn all the differen't kinds of loops. Once you learn how to use methods go back to iteration and learn how you can accomplish the same things with reccursion. These are for the most the foundations of all programming languages, if you explore them in-depth you will find yourself becomming very familiar with your chosen language.

Test your skills
  • Make a simple command console based game. Use letters/characters to represent the objects in the game. Try making it 'realtime'
Congratulations; you are now a games programmer... In that you made a game :D

AdvancedNote there is no intermediate
  • Object-oriented programming (there is alot more to cover here).
  • Pointers.
  • Multi-threading.
Expect to feel a little lost when it comes to this stuff you will likely have an 'oh now I get it' sometime and suddenly the world wont be such a scary place. OOP, pointers and multithreading all need different mind sets, multithreading can be skipped if you want.
The OOP (object oriented programming) stuff is important to get right, as a lot of data-structures and programming paradigms are either dependant on OOP, or are typically expressed in OOP. Seeing as you are using C++ you will be needing to know about pointers. Pointers link in to OOP for things like linked-lists. Which is an abstract data-type. which brings me too...

Abstract Data Types/Data-Structures
I'm not going to say all the ones you should learn, because it depends on your goals. But this is where you are starting to lookup proven structures that people have made. There is alot to cover here, and it can be a bit dry so I don't reccommend tackling it on it's own. I suggest coupling it with some graphics/games programming. If you do that you might even find some examples of where these data-structures are used, such as with binary trees etc.

Graphics
By the time you are up to graphics you will be a pretty accomplished programmer, I would say learn about this at the same time as ADTs. Choose a graphics API, I reccommend OpenGL personally, look up about matrices calculations, translation, rotation, scaling, pushing and poping, as these are how the maths works behind the scenes (its actually important knowing whats going on behind the scenes with these particular things). Obviously you will also need to learn how to create an OpenGL window, etc. Which brings me to the point of Windows Programming, you don't need to learn how to program OS based code, actually it's very important you don't get caught up with it. I remember when I was getting into OpenGL I almost ended up learning windows programming because I tried to find out what ever obscure windows call did when setting up a window. There's alot of code and you really only need to know how a window handles messages.

Test your skills
  • Make a simple game. Something basic, like a simple asteroids game. Anything you do in openGL can be done in either 2d or 3d, I reccommend making 2d but in actuality you could just as easily make a simple 3d game if you have a good understanding of 3d.
Game related maths and paradigms

Vectors! Very important... if you are smart enough to have gotten this far then you can probably make up alot of ways of going about solving problems like collision detection, etc. That said it helps to look up how other people do it, as there is no point in re-inventing the wheel and I assure you people have done things in better ways then you ;). You should look into singletons (this should probably happen after you have a solid understanding of OOP and pointers). Model View Controller is a must to learn if you plan on making any big projects. Don't be afraid to read up on these kinds of things during the Advanced Stage of learning as it puts into perspective alot of the usefullness of OOP. That said, you probably shouldn't attempt this kind of programming that early, just understand the concepts behind it to make OOP feel more useful.

Test your skills
  • Make a game engine and remake your simple game within the engine or a similar simple game. DONT get caught up in this, you will likely dump the engine afterwards, this is just so that you understand how these differen't paradigms work and how a big project could be put together.
Congratulations; you are now an openGL games programmer... In that you made a game with openGL :D

By this time you are ready to dump your engine and use someone elses, look into the technologies behind things such as scripting. Realistically it's usually impractical to use your own engine unless you are making a simple project.

Advanced challenge if you want to get into 3d
Make a simple 3d model loader (MD2 is reccommended).
Expand your model loader to allow for keyframe animation.

Expert Games Maths
  • Quaternions vs Euler rotation
  • Inverse kinematics/bone animation
Learn what quaternions are and how to use them...

Expert Graphics
  • Shaders.
Learn how to write your own shaders if you are really into graphics programming.

Expect to take years before you are truelly accomplished. If you have gotten to the stage where you are using someone elses game engine and have dumped your own then you are of about the average level of someone leaving uni that did a games degree I would think. The beginner topics wont take you nearly as long as the rest to explore which is good :). A final word of advice, obviously don't get ahead of yourself this list is a listing for someone who would want to become a proffessional level games programmer. This list isn't comprehensive, it eludes to alot of the stuff you should start to learn and expects you to research what areas.
Axolotl Pop!
Image
Or, try it for free.

For many more free games online visit www.sam-zeid.com
killercoder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 29
Joined: Sat Oct 17, 2009 4:19 pm

Re: need ideas

Post by killercoder »

This is what I have made so far :)

Code: Select all

#include <iostream>
#include <stdlib.h>
#include <string>
#include <math.h>

using namespace std;

int main(int argc, char *argv[])
{
    cout << "what would you like your name to be?" << endl;
    string name;
    cin >> name;
    cout << "hello nice to meet you " << name << endl;
    system ("PAUSE");
    cout << "what is your favorite number " << name << endl;
    int x;
    cin >> x;
    cout << "Your favorite number is " << x << endl;
    system ("PAUSE");
    return 0;
}
User avatar
davidthefat
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 529
Joined: Mon Nov 10, 2008 3:51 pm
Current Project: Fully Autonomous Robot
Favorite Gaming Platforms: PS3
Programming Language of Choice: C++
Location: California
Contact:

Re: need ideas

Post by davidthefat »

txt based calculator
User avatar
Pennywise
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 55
Joined: Tue Sep 22, 2009 1:36 pm
Favorite Gaming Platforms: Megadrive(Genesis), Dreamcast, SNES, Nintendo 64
Programming Language of Choice: C, C++ and Java
Location: England

Re: need ideas

Post by Pennywise »

Remember to start small and work your way up. If you start game development to early, you may lose interest in programming overall.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: need ideas

Post by dandymcgee »

killercoder wrote:This is what I have made so far :)

Code: Select all

#include <iostream>
#include <stdlib.h>
#include <string>
#include <math.h>

using namespace std;

int main(int argc, char *argv[])
{
    cout << "what would you like your name to be?" << endl;
    string name;
    cin >> name;
    cout << "hello nice to meet you " << name << endl;
    system ("PAUSE");
    cout << "what is your favorite number " << name << endl;
    int x;
    cin >> x;
    cout << "Your favorite number is " << x << endl;
    system ("PAUSE");
    return 0;
}
Please do not get into the habit of using "system("PAUSE");" in your program to wait for a keystroke.
Using cin.get(); or similar is a thousand times more efficient.
Read More
Last edited by dandymcgee on Sun Oct 25, 2009 2:28 pm, edited 1 time in total.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
killercoder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 29
Joined: Sat Oct 17, 2009 4:19 pm

Re: need ideas

Post by killercoder »

Ohh thank you very much for the advice ill break that bad habit :)
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: need ideas

Post by dandymcgee »

killercoder wrote:Ohh thank you very much for the advice ill break that bad habit :)
Also, not sure why you're including math.h, you only need this for functions like sqrt(), sin(), etc.
Oh and you don't need stdlib.h anymore either (cin.get() is defined in iostream). ;)

Good start, keep playing with it.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
killercoder
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 29
Joined: Sat Oct 17, 2009 4:19 pm

Re: need ideas

Post by killercoder »

Code: Select all

#include <iostream>
#include <stdlib.h>
#include <string>
#include <conio.h>

using namespace std;

int main(int argc, char *argv[])
{
    int x;
    int c = x + 5;
    string name;
    int answer1;
    cout << "what would you like your name to be?" << endl;
    cout << ">"; cin >> name;
    cout << "hello nice to meet you " << name << endl;
    system ("PAUSE");
    cout << "what is your favorite number " << name << endl;
    cout << ">"; cin >> x;
    cout << "Your favorite number is " << x << endl;
    system ("PAUSE");
    cout << "what is your favourite number +5?" << endl;
    cout << ">"; cin >> c;
    if( c != x+5 )
      cout << "Wrong@@@@" << endl;
    else if( c = x+5 )
      cout << "Correct!!" << endl;
}
I can't seem to figure out whats wrong with this code :(. it wont pause after you give you answer to last question....

P.S. It's a nooby mistake I bet lol.
andrew
Chaos Rift Regular
Chaos Rift Regular
Posts: 121
Joined: Mon Dec 08, 2008 2:12 pm

Re: need ideas

Post by andrew »

You didn't assign a value to x before you started using it.
Post Reply