User-submitted CPP Projects

114
3034 reads

February 1, 2012

Variables. Data Types.


Variables. Data Types.

We can define a variable as a portion of memory to store a determined value.

113
2622 reads
ram20

Comments

Comments are parts of the source code disregarded by the compiler. They simply do nothing.


Run It Now!
106
3834 reads
ram19

All in just one line and this would have had exactly the same meaning as the previous code.

In C++, the separation between statements is specified with an ending semicolon (;) at the end of each on


Run It Now!
124
1692 reads

February 1, 2012

ram18


// my first program in C++

#include
using namespace std;

int main ()
{
cout << "Hello World!";
return 0;
}

123
2144 reads
oddsum

#include
#include

using namespace std;

int main(int argc, char* argv[])
{
long max = 0;
long sum = 0;

cout<<"Enter Maximum No:";
cin>>max;


Run It Now!
110
2545 reads
ram4

#include

class Animal
{
public:
Animal():itsAge(1) { std::cout << "Animal constructor...\n"; }
virtual ~Animal() { std::cout << "Animal destructor...\n"; }
Animal


Run It Now!
113
2549 reads
ram3

DiamondOfNumbers


Run It Now!
121
2896 reads
Ram2

#include
using namespace std;
#include
#include

int main()
{
float a,b,c,d,e,f,g,h,i,j,n,sum,sub,mul,div;
cout<<"enter a value for a = ";
cin>>a;
cout<<"enter a


Run It Now!
122
2852 reads
Ram1

// Tic-Tac-Toe
// Plays the game of tic-tac-toe against a human opponent
#include
#include
#include
#include
using namespace std;
// global constants
c


Run It Now!
52
2587 reads