#include <iostream>
using namespace std;
int main( )
{
int a[10],x(0),y(0),i;
for(i=0;i<10;i++)
{
cin>>a[i];
if(a[i]>0) x+=a[i];
else if(a[i]<0) y+=a[i];
}
cout<<"正数和为"<<x<<"负数和为"<<y<<endl;
return 0;
}
#include <iostream>
using namespace std;
int main( )
{
int a[10],b[10],c[10],i,j(0),k(0);
for(i=0;i<10;i++)
{
cin>>a[i];
if(a[i]%2==1) b[j]=a[i],j++;
else if(a[i]%2==0) c[k]=a[i],k++;
}
for(i=0;i<j;i++)
cout<<b[i];
cout<<endl;
for(i=0;i<k;i++)
cout<<c[i];
return 0;
}
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
char str[50];
int i=0,x=0,y=0,z=0;
cout<<"输入字符串:";
gets(str);
while(str[i]!='\0')
z++;
while(str[i]!='\0')
{
if(str[i]>='0'&&str[i]<='9') x++;
i++;
}
while(str[i]!='\0')
{
if(str[i]>='A'&&str[i]<='Z') y++;
i++;
}
while(str[i]!='\0')
{
if(str[i]>='a'&&str[i]<='z') y++;
i++;
}
cout<<"其中的数字个数是: "<<x<<endl;
cout<<"其中的字母个数是: "<<y<<endl;
cout<<"其中的其它字符个数是: "<<z<<endl;
return 0;
}