#include <iostream> #include <string> using namespace std; int main() { char s1[100]; string s2; int i, len; gets_s(s1); len = strlen(s1); if (s1[0] >= '0'&&s1[0] <= '9') { s2 += s1[0]; } else { s2 += '*'; } for (i = 1; i < len; i++) { if (s1[i] >= '0'&&s1[i] <= '9') { s2 += s1[i]; } else { if (s1[i - 1] >= '0'&&s1[i - 1] <= '9') { s2 += '*'; } } } cout << s2 << endl; return 0; } /* Main.cc: In function 'int main()': Main.cc:10:11: error: 'gets_s' was not declared in this scope gets_s(s1); ^ Main.cc:11:17: error: 'strlen' was not declared in this scope len = strlen(s1); ^ */ |
Double click to view unformatted code.