It is currently November 21, 2018, 03:10:22 AM




Post new topic Reply to topic  [ 10 posts ] 
 A little bit of C++ 
Author Message
Tester
User avatar

Joined: June 10, 2008, 08:55:09 PM
Posts: 966
Location: England
Character: Stinking Hippy
Clan: Order of the Beetle
Post A little bit of C++
Looked at some video tutorials thismorning and started to learn some basic stuff :D So i made a nice little program that uses most of the stuff that i have learnt. Much easier than using my brain to add up!

Z was for me to check the numbers were right but i didnt do it. Still kept it in just to use up my memory for the crack :D

Code:
/*
Program that makes sexy time with numbers :)
Produced by : Agent Green
Reason : Practise some stuff that i learnt
Enjoy :D
*/

#include <iostream>
using namespace std;

int main ()
{
// lets make some intergers :)
    int x, y, z;
// Outputs to screen
    cout << "HERE IS A SIMPLE PROGRAM THAT DOES ADDITION FOR YOU! \n" << endl;
    cout << "Please Type In The Two Numbers You Would Like To Add Together : ";
// Inputs users input into x and y 
    cin  >> x;
    cin  >> y;
// Tells the user what x and y equal. I was going to ask them to make sure it was correct
// But i am not good enough :( sad times.
    cout << "x = " << x << " and y = " <<y << endl;
// The whole point in the program realy.
    cout << "x + y = " << x+y << endl;
// Dont we all just love system pause     
    system ("pause");
    return 0;
}


Program

Image


June 30, 2008, 05:34:04 PM
Profile
Newcomer
User avatar

Joined: July 15, 2008, 03:25:14 PM
Posts: 21
Post Re: A little bit of C++
which video tutorial?!! I would like to learn some too. :P


July 15, 2008, 08:28:10 PM
Profile
Tester

Joined: May 05, 2007, 12:49:35 PM
Posts: 413
Location: Australia
Character: Dylan
Clan: Ironfist
Post Re: A little bit of C++
Cruve wrote:
which video tutorial?!! I would like to learn some too. :P


Look over his code and figure out how each line works. Then re-write it using your own code and you'll be well on your way. This is how all good programmers learn to program.


July 27, 2008, 04:17:47 PM
Profile
Newcomer
User avatar

Joined: July 15, 2008, 03:25:14 PM
Posts: 21
Post Re: A little bit of C++
Dylan wrote:
Cruve wrote:
which video tutorial?!! I would like to learn some too. :P


Look over his code and figure out how each line works. Then re-write it using your own code and you'll be well on your way. This is how all good programmers learn to program.


thanks! question, when I write it down in c++ can I see what I am doing somehow in one of those cmd screens (before I am done)
easier to see exactly what the codes are doing xD


August 02, 2008, 06:51:00 AM
Profile
Traveller
User avatar

Joined: July 14, 2008, 12:05:00 PM
Posts: 104
Clan: Akai'zhar
Post Re: A little bit of C++
Cruve wrote:
thanks! question, when I write it down in c++ can I see what I am doing somehow in one of those cmd screens (before I am done)
easier to see exactly what the codes are doing xD


That depends. For example in Dev-C++ you can run your not yet saved code with Ctrl+F10.

_________________
Fawenah wrote:
Community Manager is all about getting rid of [...] independant thoughts and free will.

Obey and do not ask questions.


August 02, 2008, 10:54:32 AM
Profile
Newcomer

Joined: May 26, 2007, 01:28:19 PM
Posts: 24
Location: Zenedar
Post Re: A little bit of C++
I've recently started reading some tutorials to and this is my first program:

Code:
/*
*Stealing Agent Greens comment thingy*
Program that asks you two questions and then tells you your age (:
Produced by: Daudingen

*/

#include <iostream>

using namespace std;

int main(){

   int myArray[3];
// Question one
   cout << "What year is it? (four digits): ";
   cin >> myArray[0];
// Question 2
   cout << "How old are you? (2 digits): ";
   cin >> myArray[1];
// What the program is going to with the questions
   myArray[2] = myArray[0]-myArray[1];
// The answer
   cout << "The year that you mysteriously entered our world was: " << myArray[2];

   system("pause");

}



Btw the answers are often wrong because of.. well you if you can't get why then you are just 0.o
The important thing is the code, not the answers :p

Would love some advice on it.

EDIT: There might be some typos,
I am from Norway and not USA or England or some english speaking country.


August 05, 2008, 02:13:28 PM
Profile
Tester
User avatar

Joined: June 10, 2008, 08:55:09 PM
Posts: 966
Location: England
Character: Stinking Hippy
Clan: Order of the Beetle
Post Re: A little bit of C++
I cant get why it might answer wrong

Guess i am just o.0


November 30, 2008, 02:56:00 PM
Profile
Tester

Joined: April 14, 2007, 07:21:32 PM
Posts: 2159
Clan: Order of the Beetle
Post Re: A little bit of C++
Because year - age is not necessarily the birthdate.

_________________
OBA OBA OBA


November 30, 2008, 03:48:53 PM
Profile
Tester
User avatar

Joined: May 15, 2007, 09:34:31 AM
Posts: 1944
Location: Sweden
Character: Fawenah
Clan: Dwarfhood
Post Re: A little bit of C++
and is easily solved by a "if", or a date function.

_________________
Nilsson
Formerly Fawenah

Member of the Phobos community since 2005
Currently on hiatus

"Mind what people do, not only what they say, for deeds will betray a lie."


December 01, 2008, 05:16:13 PM
Profile
Tester
User avatar

Joined: June 10, 2008, 08:55:09 PM
Posts: 966
Location: England
Character: Stinking Hippy
Clan: Order of the Beetle
Post Re: A little bit of C++
Just sorted out xcode. This is a coding program for mac. Looks very powerful, maybe a bit to much as i don't even know where to start to even compile and run a simple C++ program

DOH!

Guess i will have to look at some tutorials


December 01, 2008, 11:20:11 PM
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.