The following are different ways to say "add one to variable c" in various programming languages.
They assume that you are not working near the limits of the datatype: that you are using either relatively small numbers (i.e. not close to 231 on a 32-bit system) or bignum (arbitrary precision integer) variables.
Contributions from readers:
- Pascal: c := c + 1; (from silencio)
- Ada 95: c = c + 1; (from silencio)
- Borland Pascal and Delphi: c := c + 1; or inc(c); (StrawberryFrog)
- Java with java.math.BigInteger: c.add(BigInteger.valueof(1)); or (in 1.2 or later) c.add(BigInteger.ONE); (from N-Wing)
- Forth: C @ 1 + C ! (think "C fetch 1 add C store") (from ariels). "If you want to keep the value of C on the stack (i.e. "C++" as opposed to "++C"), you'd of course just say C @ DUP 1 + C !".
(/msg me with more)
Hello World in C++:
#include <iostream>
using std::cout;
int main()
{
cout << "Hello world" << endl;
return 0;
}