圖 1. 

  試了下,是像這樣嗎? 方法有很多種.
複製程式
#include <stdio.h>
#include <stdlib.h>
void Temperature();
void Time();
void Triangle();
int main()
{
    int opt=1;
    do
      { 
          printf("1.溫度轉換\n2.時間轉換\n3.三角形判別\n4.離開\n\n請輸入要選擇的項目:");
          scanf("%d", &opt);  
          
          switch(opt){
              printf("\n");       
              case 1: Temperature(); break;     
              case 2: Time();        break;
              case 3: Triangle();    break;
              case 4:  break;     
              default: printf("\n\n您輸入的數值有誤,請重新輸入\n\n");} 
      }
    while(opt!=4);        
    system("pause");
}
void Temperature()
{
    int f;    
    printf("此為溫度換算程式,請輸入華氏溫度:");    
    scanf("%d", &f);   
    printf("\n攝氏溫度= %d \n\n", (f-32)*5/9);     
}     
void Time()
{
    int t;
    printf("此為時間自動換算程式,請輸入秒數:");
    scanf("%d",&t); 
    printf("\n您輸入的時間 = %d 小時, %d 分鐘, %d 秒 \n\n", t/3600, t%3600/60, t%60);     
}   
void Triangle()
{
    int a, b, c;
    printf("請輸入三角形邊長(空格分別):");
    scanf("%d %d %d", &a, &b, &c);
    
    if ((a+b)>c && (b+c)>a && (a+c)>b) {printf("可以構成三角形\n");}
    else{printf("無法構成三角形\n"); return;}
    
    if ((a*a)+(b*b)==c*c) {printf("為直角三角形\n");} 
    else if ((a*a)+(b*b)>c*c) {printf("此為銳角三角形\n");}
    else if ((a*a)+(b*b) < c*c) {printf("此為鈍角三角形\n");}
    
    if (a==b&&a+b>c||b==c&&b+c>a||a==c&&a+c>b) {printf("且為等腰三角形\n");} 
    printf("\n");    
}