作业1:
#include <iostream>using namespace std;namespace myspace {string str;
}int length(string str)
{//char *p = &str.at(0);const char *p = str.data();int count = 0;while (*p != 0) {p++;count++;}return count;
}
int main()
{getline(cin,myspace::str);cout << length(myspace::str) << endl;return 0;
}
思维导图