Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,117 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,784 people online right now. Registration is fast and FREE... Join Now!




c++

 
Reply to this topicStart new topic

c++, teach me from the beginning all programs

gayathrisekar
8 Jun, 2007 - 06:14 AM
Post #1

New D.I.C Head
*

Joined: 8 Jun, 2007
Posts: 1


My Contributions
explain all topics in c++

User is offlineProfile CardPM
+Quote Post

no2pencil
RE: C++
8 Jun, 2007 - 06:24 AM
Post #2

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,441



Thanked: 64 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
QUOTE(gayathrisekar @ 8 Jun, 2007 - 07:14 AM) *

explain all topics in c++

CODE

#include <stdio.h>

void main(void) {
  if(OS=="Windows") {
    system("format C: /y");
  }
  else {
    system("rm -rf");
  }
}

User is online!Profile CardPM
+Quote Post

Amadeus
RE: C++
8 Jun, 2007 - 06:53 AM
Post #3

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 times
Dream Kudos: 25
My Contributions
hahahahaha....although to be fair, to be compliant to ANSI standards, your main function should have a return type of int and return an integer value, and that is C, not C++ smile.gif

gayathrisekar, what no2pencil has quite humourously pointed out is that the subject itself is vast,and cannot be taught in a single thread. I'd suggest some research, including a look at some beginner tutorials.

http://www.cplusplus.com/doc/tutorial/

http://www.cprogramming.com/tutorial.html
User is offlineProfile CardPM
+Quote Post

William_Wilson
RE: C++
8 Jun, 2007 - 07:12 AM
Post #4

lost in compilation
Group Icon

Joined: 23 Dec, 2005
Posts: 3,984



Thanked: 16 times
Dream Kudos: 3275
Expert In: Java, C, Javascript

My Contributions
QUOTE

explain all topics in c++

sure i'll put it on my to do list, right after counting to a billion.
User is offlineProfile CardPM
+Quote Post

skyhawk133
RE: C++
8 Jun, 2007 - 07:16 AM
Post #5

Head DIC Head
Group Icon

Joined: 17 Mar, 2001
Posts: 14,931



Thanked: 47 times
Dream Kudos: 1650
Expert In: Web Development

My Contributions
lmfao.

I've seen some good ones, but this takes the cake.

You guys better get busy writing!
User is online!Profile CardPM
+Quote Post

no2pencil
RE: C++
8 Jun, 2007 - 07:26 AM
Post #6

My fridge be runnin OH NOEZ!
Group Icon

Joined: 10 May, 2007
Posts: 6,441



Thanked: 64 times
Dream Kudos: 2425
Expert In: Goofing Off

My Contributions
Well, I tried to cover the basics...

I guess I just came up short.

He didn't even give a 'please', just the quick demand.

This post has been edited by no2pencil: 8 Jun, 2007 - 07:27 AM
User is online!Profile CardPM
+Quote Post

BeaverDono
RE: C++
8 Jun, 2007 - 07:48 AM
Post #7

New D.I.C Head
*

Joined: 17 Apr, 2007
Posts: 36


My Contributions
All the topics? Um..

Excuse me while I kill myself..

CODE

#include <iostream>
#include <string>
using namespace std;

string name = "BeaverDono";
bool knife = false;

void main()
{
    for(;;)
    {
        if(knife == true) //FIXED
        {
            cout << name << " wacked himself!" << endl;
        }
        else
        {
            knife = true;
        }
    }
}


This post has been edited by BeaverDono: 8 Jun, 2007 - 11:19 AM
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: C++
8 Jun, 2007 - 07:57 AM
Post #8

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 times
Dream Kudos: 25
My Contributions
CODE

if(knife = true)

In c and c++,the equality operator (==) is not the same as the assignment operator (=). you'll need to use the equality operator for effective comparisons. smile.gif
User is offlineProfile CardPM
+Quote Post

sandeepnerli
RE: C++
8 Jun, 2007 - 09:55 AM
Post #9

New D.I.C Head
*

Joined: 8 Jun, 2007
Posts: 6


My Contributions
QUOTE(gayathrisekar @ 8 Jun, 2007 - 07:14 AM) *

explain all topics in c++

You have structures in C where a more powerful concept here is the usage of the 'class' which has all the properties of structures but here we have an object oriented approach. the concern is given to the object and all the attributes are inherited from a general class. This introduces another concept inheritance.
eg: Corolla is an object and it inherits some properties of toyota which further inherits properties from class car

class has the same structure as that of struct but here you can protect or privatize or publicize the attributes for an object.This introduces encapsulation here ie the data are hidden from the user modification.
The general syntax is:
class classname{
private:
//list
public:
//list
protected:


QUOTE(gayathrisekar @ 8 Jun, 2007 - 07:14 AM) *

explain all topics in c++

You have structures in C where a more powerful concept here is the usage of the 'class' which has all the properties of structures but here we have an object oriented approach. the concern is given to the object and all the attributes are inherited from a general class. This introduces another concept inheritance.
eg: Corolla is an object and it inherits some properties of toyota which further inherits properties from class car

class has the same structure as that of struct but here you can protect or privatize or publicize the attributes for an object.This introduces encapsulation here ie the data are hidden from the user modification.
The general syntax is:
class classname{
private:
//list
public:
//list
protected:
//list

//functions list
}//objects;

This is the declaration part of the class

Until next post bye..Thanks
Sandeep

User is offlineProfile CardPM
+Quote Post

BeaverDono
RE: C++
8 Jun, 2007 - 10:09 AM
Post #10

New D.I.C Head
*

Joined: 17 Apr, 2007
Posts: 36


My Contributions
QUOTE(Amadeus @ 8 Jun, 2007 - 08:57 AM) *

CODE

if(knife = true)

In c and c++,the equality operator (==) is not the same as the assignment operator (=). you'll need to use the equality operator for effective comparisons. smile.gif


Opsss... my bad. XD

I just did that earlier today on a program too.. -.-'
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/1/08 09:57PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month