__old C++ Lesson2: Some Basics

You can talk about anything. (please read forum rules before posting)

Moderator: thunderchero

User avatar
xDx
Commander
Commander
Posts: 299
Joined: Sat May 10, 2008 2:00 am
Location: East Coast, USA

Re: C++ Lesson2: Some Basics

Post by xDx »

I'm dropping out lol I got no time for this and games atm. Just keep going I will try and pick it back up in the near future
"The only thing we have to fear is fear itself." -- FDR
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3257
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: C++ Lesson2: Some Basics

Post by Flocke »

ok, two guys is too few to continue, we'll wait
KrazeeXXL
BORG Trouble Maker
BORG Trouble Maker
Posts: 2323
Joined: Sat Jan 03, 2009 3:00 am
Location: the 36th Chamber

Re: C++ Lesson2: Some Basics

Post by KrazeeXXL »

I'm still here although I rarely was here actively which I regret since it's a great project and it definitely needs some support!

I'm sincerly sorry because I didn't support it earlier.

tbh, most of those questions, I asked myself a long time ago... but at first sight it was just a 1x1 for me so I didn't thought it to be important. But... google this forums and you find my 2nd nickname: "often wrong" ;)

So, I'm following the thread since the early beginning and will continue to do so. Having no time for this? no? just lame excuses of ppl who're talking too much hollow bs, who're impulsive and can't keep their promises! I know...WOW dude oO ...

but

I'm hart...and I'am fair...

if you actively want to do something, yea anything for BotF, follow this thread! normally this costs hundreds, yea thousands of dollars and nobody's interested in your stupid questions!

so take that as an opportunity! it won't come back. I tell you this. It is now and here. And in some weeks it'll be vanished. So ask your questions to the pros now!


I'm no pro, have serious health problems atm but I'm here. You know... for that 13 year old game which connects all of us ;D

edited 2 times by request of OP

wanted to add something: what I said about ppl and lame excuses.
I know some of you (Breen, Thet) would like to but really can't participate atm! So don't get me wrong on this one.
Last edited by KrazeeXXL on Thu Jun 14, 2012 11:48 am, edited 2 times in total.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3257
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: C++ Lesson2: Some Basics

Post by Flocke »

morning, just reading this,
thanks for your support krazee, sry I didn't call ya back last days, will call ya later today

I mean this course for serious and it's true, normally you'd have to pay lots to get personal training like this.
That's my first such course so bear with me when I miss explaining something, it's too much at once or I'm becoming too complicate. Already thought about splitting this lesson to two seperate ones. :roll:
I'll progress in smaller steps if/when we do.
All help I gave to thunderchero was explained but the brackets. It does not help others to lengthen this thread by repeating myself. But like I said, I'm around for questiones. Just tell where you hang, together we'll do it.
But it's important to find some own motivation for it, I can't just tell and you get it by words. Learning to program is something that needs practice.
Even if you fail with errors it's great as dealing with errors is common when programming. Read the messages, try to understand some, eventually do a quick search, it already might solve your problem.
When I began learning to program, I read articles, books and tutorials and had noone that gave help nor orientation and a track. That's been a long slow learning curve with lots of different, often great experiences, but it's also been very inefficient learning. I'm not going to teach you the way I learned programming...

edit:
thanks for editing your post, much better now
your participation is welcome

hope it's not too bad on your health :(
Last edited by Flocke on Thu Jun 14, 2012 5:33 pm, edited 2 times in total.
User avatar
Tethys
Past Administrator
Past Administrator
Posts: 2404
Joined: Fri Jul 18, 2008 2:00 am
Location: Your mom's bed ;)
Contact:

Re: C++ Lesson2: Some Basics

Post by Tethys »

I can't do much from a phone :(
Not for the weak of heart...
Galaxies MOD v0.4.0 <--- GALM/Galaxies Mod latest version
KrazeeXXL
BORG Trouble Maker
BORG Trouble Maker
Posts: 2323
Joined: Sat Jan 03, 2009 3:00 am
Location: the 36th Chamber

Re: C++ Lesson2: Some Basics

Post by KrazeeXXL »

what happened to your PC Tet?
User avatar
anjel
Past Administrator
Past Administrator
Posts: 666
Joined: Thu May 08, 2008 2:00 am
Location: Bs As - Argentina

Re: C++ Lesson2: Some Basics

Post by anjel »

Flocke wrote:
What I want you to do now is create another method, declare in header, define in the cpp. Don't forget the return type like it's been with main.
In that print something to the console again. don't forget to add the iostream header to your source file so you can make use of cout.
Now in main.cpp, include your class header, create an instance of your class by typing your_class_name myClassInstanceName;
afterwards call your new method by myClassInstanceName.myMethod();
Test to get that work.
well, i´m stuck here.
How do i create another method ?, should be like this ? :
  • #include <iostream>
    #include <cstdlib>
    #include <lala>

    using namespace std;

    int main()
    {
    cout << "Hello world!" << endl;
    cout << "Let botf begin !!!" << endl;
    system("PAUSE");
    return 0;
    }
ok, i´ve changed "<lala> to <surak.h>

and i have these on "src\surak.cpp"

Code: Select all

#ifndef SURAK_H
#define SURAK_H


class surak
{
    public:
        surak();
        virtual ~surak();
    protected:
    private:
};

#endif // SURAK_H
User avatar
anjel
Past Administrator
Past Administrator
Posts: 666
Joined: Thu May 08, 2008 2:00 am
Location: Bs As - Argentina

Re: C++ Lesson2: Some Basics

Post by anjel »

ok, double posting, but now with the problem SOLVED :D

main.ccp

Code: Select all

#include <iostream>
#include <cstdlib>
#include <surak.h>

using namespace std;


int main()
{
    surak tpol;
    tpol.this_is_my_new_method_with_return();
    cout << "Hello world!" << endl;
    cout << "Let botf begin !!!" << endl;
    system("PAUSE");
    return 0;

}
src\surak.cpp

Code: Select all

#include "surak.h"
#include <iostream>

using namespace std;

int surak::this_is_my_new_method_with_return()
{
   cout << "method called" << endl;
   return 0;
}


surak::surak()
{
    cout << "Flocke, what you think ?" << endl;
    //ctor
}

surak::~surak()
{
    //dtor
}
include\surak.h

Code: Select all

#ifndef SURAK_H
#define SURAK_H


class surak
{
    public:
        surak();
        virtual ~surak();
        int this_is_my_new_method_with_return();
    protected:
    private:
};

#endif // SURAK_H
this is what i get:



Thank you Flocke !!!
Live long and propser
Dr_Breen
Commodore
Commodore
Posts: 889
Joined: Wed Apr 30, 2008 2:00 am
Location: Zurich, Switzerland
Contact:

Re: C++ Lesson2: Some Basics

Post by Dr_Breen »

ha. i am back. tonight i will finish L2 and then i'll conquer the world. muahahaha
Public BotF / EF2 Teamspeak 3 Server: 83.169.13.55
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3257
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: C++ Lesson2: Some Basics

Post by Flocke »

Dr_Breen wrote:ha. i am back. tonight i will finish L2 and then i'll conquer the world. muahahaha
perfect!
Well, might split lesson2 later today or tomorrow, but that doesn't matter as content will keep (almost) the same. :)
Mainly I want to move all about classes to lesson3 and give better samples to all the novices.
Post Reply

Return to “General Chat”