Declaring strings as std:string in C++

前端 未结 4 1629
花落未央
花落未央 2021-01-15 05:54

This is based on GCC/G++ and usually on Ubuntu.

Here\'s my sample program I\'ve done:

#include 

using namespace std;

int main()
{
          


        
4条回答
  •  抹茶落季
    2021-01-15 06:04

    You need to include the string class header:

    #include 
    

    This code has a typo, missing a second colon

    std:string N;
    

    should be:

    std::string N;
    

    With a single colon, it becomes a label for goto, which is probably not what you meant.

提交回复
热议问题