Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

A fresh emelentary in c++ needs you...

red3warlordred3warlord Member Posts: 77
hi to all,

i am red3warlord, and i had already learned about pascal, vb, and c. I want to learn now more about c++. is there anyone who can help me out of this one?

as far as my knowledge is concern, pascal goes like this:
[code]
program program_name;
var
(variabes) as (datatype)
clrscr;
begin

.
.
.
end
[/code]

while c goes like this one:
[code]
#include
main()
datatype declaration
constant declaration
variable declaration
{
clrscr();

.
.
.
getche();
}
[/code]

my first question is:

what is the basic formulation of c++?


from red3warlord with gratitude always saying,

"let the rain begin, blessings are with them to gain..."

Comments

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    It's C, but it has new language elements - most notably of which is the Class and Templates.

    Classical difference:
    [code]
    /* C */
    #include
    int main()
    {
    printf("Hello world
    ");
    return 0;
    }
    [/code]

    [code]
    //C++
    #include
    using std::cout;

    int main()
    {
    cout << "Hello world
    ";
    return 0;
    }
    [/code]

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • MT2002MT2002 Member Posts: 1,444
    I personally prefer to think of C and C++ as completely different languages. Granted, C++ was based off of C (This concludes that most C code will work in C++), Some ANSI C code will [b]NOT[/b] work with ANSI C++, however.

    C++ has synthetic constructs based off of Object Oriented Programming (OOP), which includes: Classes, Polymorphism, Inheritance, Encapsulation, Public/Private/Protected class/struct members, operator overloading, templates, and better constant declarations (i.e., The keyword "const".

    ...And, who can forget namespaces? ^^

    Here is a nice website + beginners C++ tutorial:

    [link=http://www.cplusplus.com/doc/tutorial/]CLICKY[/link]

    Here is a free online ebook on C++:

    [link=http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html]CLICKY[/link]

    [code]
    #include
    main()
    datatype declaration
    constant declaration
    variable declaration
    {
    clrscr();

    .
    .
    .
    getche();
    }[/code]
    You are correct in saying this is C. Newer C compliers, alongside C++, support more freedom in declaration statements. [b]That is, C++ does still support this format.[/b] However, in C++, [b]you can place declarations wherever you like within their scope.[/b]

    Good luck:-)

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
Sign In or Register to comment.