| C++ | C |
|---|---|
|
int x; float y; char ch; cout << "Hello."; cout << x; cout << "y = " << y << endl; cout << ch << " = " << x << endl; |
int x; float y; char ch; printf("Hello."); printf("%d",x); printf("y = %f\n", y); printf("%c = %d\n", ch, x); |
| cin >> x; cin >> y; |
scanf("%d", &x); scanf("%f", &y); |
| #include<iostream.h> | #include<stdio.h> |
| const float PI = 3.14; | #define PI 3.14 |
| declare variables anywhere | variable declarations have to be at the beginning of a function NOT in the middle/end/etc. |
| g++ -o doom doom.C | gcc -o doom doom.c |