#include<iostream>
using namespace std;
int main()
{
char str[30];
char * sp=str;
cout<<"请输入字符串:"<<endl;
cin.getline(sp,30); //也可以(str,30)
cout<<"输出大写字母:"<<endl;
for(;*sp!='\0';sp++)
{
if(*sp>='A'&&*sp<='Z')
{
cout<<*sp<<" ";
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: