64,637
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <cmath>
#include <string>
using namespace std;
int main()
{
string str;
while(1)
{
cin >> str;
unsigned int i = 0;
int count = 0;
while( i < str.length() )
{
if(str[i] >= 'A' && str[i] <= 'z' )
++count;
i++;
}
cout << count << endl;
}
return 0;
}
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double Perimeter( double length1, double length2, double length3 )
{
return ( 0.5 * (length1 + length2 + length3 ) );
}
double Area( double length1, double length2, double length3 )
{
double perimeter = Perimeter( length1, length2, length3 );
double area = sqrt(perimeter * ( perimeter -length1 ) * ( perimeter - length2 ) * ( perimeter - length3 ) );
return area;
}
int main()
{
double length1,length2,length3;
int Count;
cout << "input Count: ";
cin >> Count;
for(int iCount = 0;iCount < Count; ++iCount)
{
cin >> length1 >> length2 >> length3;
//cout.setf( ios::showpoint );
//cout << setprecision(4) << Area( length1, length2, length3 ) << endl;
printf("%.3lf\n",Area( length1, length2, length3 ));
}
return 0;
}