分支15---日K蜡烛图(15)

分支15---

日K蜡烛图(15)

#include <iostream>
#include <string>
#include <math.h>
using namespace std;


int main()
{
double open = 0.0, high = 0.0, low = 0.0, close = 0.0;
while (cin>>open>>high>>low>>close)
{
bool flag1 = false, flag2 = false;
if (close < open)
{
printf("BW-Solid");
}
else if (close>open)
{
printf("R-Hollow");
}
else
{
printf("R-Cross");
}
if (low<open && low<close)
{
flag1 = true;
}
if (high>open && high>close)
{
flag2 = true;
}
if (flag1 ==true && flag2==true)
{
printf(" with Lower Shadow and Upper Shadow");
}
else if (flag1 == true && flag2 == false)
{
printf(" with Lower Shadow");

}
else if (flag1 == false && flag2 == true)
{
printf(" with Upper Shadow");
}
printf("\n");
}
}


分支16---

计算分段函数(10)

#include <iostream>
#include <string>
#include <math.h>
using namespace std;


int main()
{
double x = 0.0;
while (cin>>x)
{
double y = 0.0;
if (x>=0)
{
y = pow(x ,0.5);
}
else
{
y = (x + 1)*(x + 1) + 2 * x + 1 / x;
}
printf("f(%.2f) = %.2f\n",x ,y);
}
}
分支--17

统计学生成绩(15)

#include <iostream>
#include <string>
#include <math.h>
using namespace std;


int main()
{
int N = 0;
while (cin>>N)
{
if (N<0||N>1000)
{
break;
}
int score = 0;
int A = 0, B = 0, C = 0, D = 0, E = 0;
while (N--)
{
cin >> score;

if (score<0||score>100)
{
break;
}
switch (score/10)
{
case 10:
case 9:
A++;
break;
case 8:
B++;
break;
case 7:
C++;
break;
case 6:
D++;
break;
default: 
E++;
break;
}
}
printf("%d %d %d %d %d\n",A,B,C,D,E);
}
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值