Skip to content

Commit ff40d20

Browse files
authored
Create Hello World.c
1 parent f3f7a77 commit ff40d20

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* Task
2+
To complete this challenge, you must save a line of input from stdin to a variable, print Hello, World. on a single line, and finally print the value of your variable on a second line.
3+
4+
You've got this!
5+
6+
Note: The instructions are Java-based, but we support submissions in many popular languages. You can switch languages using the drop-down menu above your editor, and the variable may be written differently depending on the best-practice conventions of your submission language.
7+
8+
Input Format
9+
10+
A single line of text denoting (the variable whose contents must be printed).
11+
12+
Output Format
13+
14+
Print Hello, World. on the first line, and the contents of on the second line.
15+
16+
Sample Input
17+
18+
Welcome to 30 Days of Code!
19+
Sample Output
20+
21+
Hello, World.
22+
Welcome to 30 Days of Code!
23+
Explanation
24+
25+
On the first line, we print the string literal Hello, World.. On the second line, we print the contents of the variable which, for this sample case, happens to be Welcome to 30 Days of Code!. If you do not print the variable's contents to stdout, you will not pass the hidden test case. */
26+
#include <cmath>
27+
#include <cstdio>
28+
#include <vector>
29+
#include <iostream>
30+
#include <algorithm>
31+
using namespace std;
32+
int main() {
33+
// Declare a variable named 'input_string' to hold our input.
34+
string input_string;
35+
36+
// Read a full line of input from stdin (cin) and save it to our variable, input_string.
37+
getline(cin, input_string);
38+
39+
// Print a string literal saying "Hello, World." to stdout using cout.
40+
cout << "Hello, World." << endl;
41+
42+
// TODO: Write a line of code here that prints the contents of input_string to stdout.
43+
44+
return 0;
45+
}

0 commit comments

Comments
 (0)