Hello World Solution in CPP

This Page Contains the Solution in CPP Programming Language for the Day 0 : Hello World , Code Challange of the HackerRank 30 Days of Code.

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    // Declare a variable named 'input_string' to hold our input.
    string input_string; 
    
    // Read a full line of input from stdin (cin) and save it to our variable, input_string.
    getline(cin, input_string); 
    
    // Print a string literal saying "Hello, World." to stdout using cout.
    cout << "Hello, World." << endl;

    // TODO: Write a line of code here that prints the contents of input_string to stdout.
    cout<< input_string;

    return 0;
}

Last updated

Was this helpful?