输入文件的后缀名,并判断是使用c,c++,java编写,还是其他编程语言编写
例如,输入b.c 输出c
输入a.cpp输出c++
输入c.java输出java
#include <stdio.h>
#include <string.h>
int main()
{
int i,n,k,t=0,p=0,q=0;
char str[20];
gets(str);
n=strlen(str);
for(i=n-1;i>=0;i--)
if(str[i-2]=='c'&&str[i-1]=='p'&&str[i]=='p')
{printf("c++");t=1;break;}
else if(str[n-1]=='c')
{printf("c");p=1;break;}
else if(str[i-3]=='j'&&str[i-2]=='a'&&str[i-1]=='v'&&str[i]=='a')
{printf("java");q=1;break;}
else
{printf("none");break;}
return 0;
}