Converting from Java to C++

The major difference between C++ and Java is that not everything is a class. In particular, the main function is part of the 'top level', so get rid of the class definitions.

Converting from Java to C++

The major difference between C++ and Java is that not everything is a class. In particular, the main function is part of the 'top level', so get rid of the class definitions.

Converting from Java to C++

The major difference between C++ and Java is that not everything is a class. In particular, the main function is part of the 'top level', so get rid of the class definitions.

Converting from Java to C++

The major difference between C++ and Java is that not everything is a class. In particular, the main function is part of the 'top level', so get rid of the class definitions.

Converting from Java to C++

The major difference between C++ and Java is that not everything is a class. In particular, the main function is part of the 'top level', so get rid of the class definitions.

Converting from Java to C++

Becuse it's part of the top level, the public and static keywords have no meaning.

Converting from Java to C++

Becuse it's part of the top level, the public and static keywords have no meaning.

Converting from Java to C++

Becuse it's part of the top level, the public and static keywords have no meaning.

Converting from Java to C++

The main function can return an integer value to the calling environment (usually 0), but if you don't care, just declare the function void

Converting from Java to C++

Also, if you don't want to use the command line arguments, don't declare them.

Converting from Java to C++

Also, if you don't want to use the command line arguments, don't declare them.

Converting from Java to C++

Also, if you don't want to use the command line arguments, don't declare them.

Converting from Java to C++

Now for the I/O. Well, just O really. First of all, all the Java I/O classes are in the java.io package.

Converting from Java to C++

Now for the I/O. Well, just O really. First of all, all the Java I/O classes are in the java.io package.

Converting from Java to C++

Now for the I/O. Well, just O really. First of all, all the Java I/O classes are in the java.io package.

Converting from Java to C++

In C++, use #include insted of import.

Converting from Java to C++

In C++, use #include insted of import.

Converting from Java to C++

In C++, use #include insted of import.

Converting from Java to C++

and the simple I/O functionality is declared in the header file <iostream.h>.

Converting from Java to C++

and the simple I/O functionality is declared in the header file <iostream.h>.

Converting from Java to C++

and the simple I/O functionality is declared in the header file <iostream.h>.

Converting from Java to C++

The output object is called cout...

Converting from Java to C++

The output object is called cout...

Converting from Java to C++

The output object is called cout...

Converting from Java to C++

...and instead of using a println method, use the output operator to pass the data-to-print to the output object.

Converting from Java to C++

...and instead of using a println method, use the output operator to pass the data-to-print to the output object.

Converting from Java to C++

...and instead of using a println method, use the output operator to pass the data-to-print to the output object.

Converting from Java to C++

...and instead of using a println method, use the output operator to pass the data-to-print to the output object.

Converting from Java to C++

...and instead of using a println method, use the output operator to pass the data-to-print to the output object.

Converting from Java to C++

...and instead of using a println method, use the output operator to pass the data-to-print to the output object.

Converting from Java to C++

...and instead of using a println method, use the output operator to pass the data-to-print to the output object.

Converting from Java to C++

And that's the simple HelloWorld program. You can make it slightly more complex by filling out the signature for main()...

Converting from Java to C++

And that's the simple HelloWorld program. You can make it slightly more complex by filling out the signature for main()...

Converting from Java to C++

And that's the simple HelloWorld program. You can make it slightly more complex by filling out the signature for main()...

Converting from Java to C++

And that's the simple HelloWorld program. You can make it slightly more complex by filling out the signature for main()...

Converting from Java to C++

And that's the simple HelloWorld program. You can make it slightly more complex by filling out the signature for main()...

Converting from Java to C++

And that's the simple HelloWorld program. You can make it slightly more complex by filling out the signature for main()...

Converting from Java to C++

And that's the simple HelloWorld program. You can make it slightly more complex by filling out the signature for main()...

Converting from Java to C++

...but I'm not going to tell you what that means yet!

public class HelloWorld{

public static void main(String[] args){
	System.out.println("Hello World");
	}

}
public class HelloWorld{

public static void main(String[] args){
	System.out.println("Hello World");
	}

}
public static void main(String[] args){
	System.out.println("Hello World");
	}

}
public static void main(String[] args){
	System.out.println("Hello World");
	}

}
public static void main(String[] args){
	System.out.println("Hello World");
	}
public static void main(String[] args){
	System.out.println("Hello World");
	}
public static void main(String[] args){
	System.out.println("Hello World");
	}
void main(String[] args){
	System.out.println("Hello World");
	}
void main(String[] args){
	System.out.println("Hello World");
	}
void main(String[] args){
	System.out.println("Hello World");
	}
void main(String[] args){
	System.out.println("Hello World");
	}
void main(){
	System.out.println("Hello World");
	}
void main(){
	System.out.println("Hello World");
	}
*void main(){
	System.out.println("Hello World");
	}
import java.io.*;

void main(){
	System.out.println("Hello World");
	}
import java.io.*;

void main(){
	System.out.println("Hello World");
	}
import java.io.*;

void main(){
	System.out.println("Hello World");
	}
#include java.io.*;

void main(){
	System.out.println("Hello World");
	}
#include java.io.*;

void main(){
	System.out.println("Hello World");
	}
#include java.io.*;

void main(){
	System.out.println("Hello World");
	}
#include <iostream.h>

void main(){
	System.out.println("Hello World");
	}
#include <iostream.h>

void main(){
	System.out.println("Hello World");
	}
#include <iostream.h>

void main(){
	System.out.println("Hello World");
	}
#include <iostream.h>

void main(){
	cout.println("Hello World");
	}
#include <iostream.h>

void main(){
	cout.println("Hello World");
	}
#include <iostream.h>

void main(){
	cout.println("Hello World");
	}
#include <iostream.h>

void main(){
	cout << "Hello World");
	}
#include <iostream.h>

void main(){
	cout << "Hello World*");
	}
#include <iostream.h>

void main(){
	cout << "Hello World\n");
	}
#include <iostream.h>

void main(){
	cout << "Hello World\n");
	}
#include <iostream.h>

void main(){
	cout << "Hello World\n" ;
	}
#include <iostream.h>

void main(){
	cout << "Hello World\n" ;
	}
#include <iostream.h>

void main(){
	cout << "Hello World\n" ;
	}
#include <iostream.h>

int main(){
	cout << "Hello World\n" ;
	}
#include <iostream.h>

int main(){
	cout << "Hello World\n" ;
	*}
#include <iostream.h>

int main(){
	cout << "Hello World\n" ;
	return 0;
	}
#include <iostream.h>

int main(){
	cout << "Hello World\n" ;
	return 0;
	}
#include <iostream.h>

int main(int argc, char *argv[]){
	cout << "Hello World\n" ;
	return 0;
	}
#include <iostream.h>

int main(int argc, char *argv[]){
	cout << "Hello World\n" ;
	return 0;
	}