Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to insert variable into string c++

#include <iostream>

using namespace std;

int main()
{

    //variables
    string name = "Jacob";
    int age = 21;

    //code with variable insertions
    cout << name << " was a cool dude." << endl;
    cout << "So it's weird that no one really liked " << name << "." << endl;
    cout << name << " was " << age << " years old." << endl;

    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: double array c++ 
Cpp :: cpp execute command 
Cpp :: take a function as an argument in c++ 
Cpp :: print in c ++ 
Cpp :: linux c++ sigint handler 
Cpp :: vector from angle 
Cpp :: c++ fonksion pointer 
Cpp :: fill vector with zeros c++ 
Cpp :: bfs sudocode 
Cpp :: c++ string_t to string 
Cpp :: resharper fold if statement 
Cpp :: basic cpp 
Cpp :: what is a variable in cpp 
Cpp :: rethrow exception c++ 
Cpp :: potato 
Cpp :: how to increase array memory in c++ 
Cpp :: c++98 check if character is integer 
Cpp :: c++ catch Unhandled exception 
Cpp :: c++ memset 
Cpp :: __builtin_popcount 
Cpp :: minimum characters to make string palindrome 
Cpp :: c++ else if 
Cpp :: abs in c++ used for 
Cpp :: c++ function overloading 
Cpp :: ? c++ 
Cpp :: print all number between a and b in c++ 
Cpp :: largest subarray with zero sum 
Cpp :: faster solutions 
Cpp :: how to create windows warning message c++ 
Cpp :: c program runner 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =