sizeof continues to return 4 instead of actual size

前端 未结 5 1154
孤街浪徒
孤街浪徒 2020-12-21 04:07
#include 

using namespace std;

int main()
{
    cout << \"Do you need to encrypt or decrypt?\" << endl;
    string message;
    getline         


        
5条回答
  •  情话喂你
    2020-12-21 04:24

    sizeof(type) returns the size of the type, not the object. Use the length() method to find the length of the string.

提交回复
热议问题