Answers for "c++ print variable"

C++
3

c++ print string

std::cout << "";
Posted by: Guest on November-28-2020
1

c++ print variable

cout << x;
cout << "X is: " << x << endl;
//endl is to end the line
Posted by: Guest on February-18-2021
0

c++ input from terminal when program is called

#include <iostream>
#include <string>

int main( int argc, char* argv[] )
{
    std::string my_arg;

    // First argument is always the name of your program
    std::cout << argv[0] << std::endl;

    if( argc == 2 )
    {
        // Something has been passed in
        my_arg = argv[1];
        std::cout << "Argument passed in is " << my_arg << std::endl;
    }

    return 0;
}
Posted by: Guest on October-29-2020
0

c++ cout int

#include <iostream>

std::cout << "Hello, World!" << std::endl;
Posted by: Guest on June-30-2020

Browse Popular Code Answers by Language