Answers for "declare string in cpp"

C++
4

how can make string value in cpp

#include <string>
string hello= "hello you thre :)";
Posted by: Guest on June-07-2020
3

string in cpp

// you want to include <string>
#include <string>
#include <iostream>

int main() 
{
  string helloWorld = "Hello World!"; // creating string and assigning
  std::cout << helloWorld;            // will output what you assigned it!
                                      /* you can also use strings with user 
                                      input (cin/getline)*/
  string namePerson{};
  getline(cin, namePerson); // getline allows for multi word input
  std::cout << namePerson;  // outputs name which person inputted
}
Posted by: Guest on October-20-2020
0

how to print string data type in c++

printf("%sn",someString.c_str());
Posted by: Guest on April-26-2020
-1

how to declare a string c++

// Include the string library
#include <string>

// Create a string variable
std::string greeting = "Hello";
Posted by: Guest on August-20-2021

Browse Popular Code Answers by Language