/*============================================================================
Name : Exercise.cpp
Author : Haier
Version : 1.01
Copyright : Copyright (c) 2014
Description : Consele program in C, Ansi-style, Compile by Code:Block
============================================================================*/
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <windows.h>
int main()
{
HANDLE Color;
char Choice='y';
double Param;
Color=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(Color,FOREGROUND_RED);
printf("Hello ,EveryBody !\n");
do
{
fflush(stdin);
printf("Please input your choice :");
scanf("%c",&Choice);
switch(toupper(Choice))
{
case 'S':
{
printf("Please input the param: ");
scanf("%lf",&Param);
printf("\n%lf",sin(Param));
break;
}
case 'C':
{
printf("Please input the param: ");
scanf("%lf",&Param);
printf("\n%lf",cos(Param));
break;
}
case 'T':
{
printf("Please input the param: ");
scanf("%lf",&Param);
printf("\n%lf",tan(Param));
break;
}
default:
{
printf("Wrong Param !\n");
}
}
fflush(stdin);
printf("\nDo You want to try again ?");
scanf("%c",&Choice);
}while(toupper(Choice)=='Y');
return 0;
}