笔记:
1. strchr函数 <string.h>头文件
char *strchr(const char *str, int c)   //str字符串中c字符的第一次出现的位置,如果未找到返回NULL
2. if(条件语句)
条件语句运算结果不是0则执行if语句块
2054
Problem Description Give you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".
Input each test case contains two numbers A and B.
Output for each case, if A is equal to B, you should print "YES", or print "NO".
Sample Input
1 2
Sample Output
NO
#include<stdio.h>
#include<string.h>
void delzero(char a[]);
int main()
{
    char a[100000],b[100000];   //数组要大一些,不然会Runtime Error(ACCESS_VIOLATION)
    while(scanf("%s %s",&a,&b)!=EOF){
    	delzero(a);
    	delzero(b);
		if(strcmp(a,b)==0){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}	
	}
    return 0;
}
//函数功能:如果有小数点并且末尾有0,消除0
void delzero(char a[]){  
	if(strchr(a,'.')){         //判断是否有小数点
		int i = strlen(a)-1;
		while(a[i]=='0'){
			a[i] = '\0';
			i--;
		}
	}
	if(a[strlen(a)-1]=='.'){
		a[strlen(a)-1]='\0';  //将最后一位小数点消除
	}
}
来源:https://blog.csdn.net/qq_41924481/article/details/99545519