a C ++ version of the example HelloJava.java

someone shows me a C ++ version of the example HelloJava.java. please

1
2
3
4
5
6
7
8
// helloJava.java
class hellojava {
  public static void main(String t[]) {
        if(t.length == 0) System.out.println("hello java");
	else for(int i=0; i<t.length; i++)
	System.out.println("hello "+t[i]);
  }
}
why not try it on your own? thats how you learn.
okay I will try
thanks :)
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

int main(int argc, char *argv[])
{
  if(argc < 2)
    std::cout << "hello C++";
  else for(int i=1; i<argc; i++)
  {
    std::cout << "hello " << argv[i] << std::endl;
  }
}
thanks
Topic archived. No new replies allowed.