+ 1
Count characters
i'm trying to make that the 'sizeof' function counts the size of the variable with user asigned value. The following code don't work #include<iostream> #include<string> using namespace std; int main() { int text = new int; cin >> text; cout << sizeof(text); return 0; }
1 Antwort
+ 3
// Count characters
#include<iostream>
#include<string>
using namespace std;
int main()
{
string text;
cin >> text;
cout << text.size();
return 0;
}