-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHelloWorld.cpp
More file actions
27 lines (17 loc) · 832 Bytes
/
HelloWorld.cpp
File metadata and controls
27 lines (17 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//
// Created by jskag on 6/20/2022.
//
#include <iostream> // allows you to print streams to the command line
using namespace std; //
int main(int argc, char *argv[]) {
// argc in an integer that tell you how many arguments were passed from the command line
// argv is an array of length argc that contains the
if (argc < 2) { // we are checking to see if any arguments were passed in
cout << "Hello World" << endl; // print hello message to the command line
}
else { // if there was an argument passed into then display a different message greeting the name of the person
cout << "Hello " << argv[1] << ", welcome to the world of computer science!" << endl; // print hello greeting to the command line
}
return -1;
return 0; // 0 implies that the program ran successfully
}