记第一个“屎山“

pta刷题前看了翁恺老师讲的字符串部分,本着活学活用的原则,创造了第一个无法跑起来的及其复杂代码,并且逻辑混乱(꒪⌓꒪)

有时间再尝试补救~~

另:正解为:(3条消息) 7-13 日K蜡烛图 (15 分)_小白程序员丶钟同学的博客-CSDN博客_日k蜡烛图

 

 屎山如下:

#include <stdio.h>//此代码目前跑不动
#include <string.h>
int main()
{
	double open,high,low,close;
	char s1[9] = "BW-Solid";
	char s2[9] = "R-Hollow";
	char s3[20] = " Lower Shadow";
	char s4[20] = " Upper Shadow";
	char s5[5] = " with";
	char s6[5] = " and";
	char s7[9] = "R-Cross";
	
	scanf("%lf",&open,&high,&low,&close);
	
	if(close<open){
		if(low<open&&low<close){
			if(high>open&&high>close){
				strcat(s1,s5);
				strcat(s1,s3);
				strcat(s1,s6);
				strcat(s1,s4);
				printf("%s",s1);
			}
			else{
				strcat(s1,s5);
				strcat(s1,s3);
				printf("%s",s1);
			}
		} 
		else if(high>open&&high>close){
			strcat(s1,s5);
			strcat(s1,s4);
			printf("%s",s1);
		}
		else{
			printf("%s",s1);
		}
		
	}
	
	
	
	
	else if(close>open){
			if(low<open&&low<close){
			if(high>open&&high>close){
				strcat(s2,s5);
				strcat(s2,s3);
				strcat(s2,s6);
				strcat(s2,s4);
				printf("%s",s2);
			}
			else{
				strcat(s2,s5);
				strcat(s2,s3);
				printf("%s",s2);
			}
		}
	}
	
	
	else{
		if(low<open&&low<close){
			if(high>open&&high>close){
				strcat(s7,s5);
				strcat(s7,s3);
				strcat(s7,s6);
				strcat(s7,s4);
				printf("%s",s7);
			}
			else{
				strcat(s7,s5);
				strcat(s7,s3);
				printf("%s",s7);
			}
		}
		
	}

	return 0;
}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值