回覆列表
  • 1 # 不會抽菸的煙

    C語言的如下:#include <stdio.h>void main(){int max(int x,int y,int z); int a,b,c,e; printf("請輸入三個整數!\n"); scanf("%d %d %d",a,b,c); e=max(a,b,c); printf("max=%d\n",e);}int max(int x,int y,int z){ int t=x>y?x:y; t=t>z?t:z; return (t); }C++的如下:#include <iostream>using namespace std;int max(int x,int y,int z){ int t=x>y?x:y; t=t>z?t:z; return t; } int main() { int x,y,z; cout<<"請輸入三個整數!"<<endl; cin>>x>>y>>z; cout<<x<<","<<y<<","<<z<<"的最大值為"<<max(x,y,z)<<endl; system("PAUSE"); return 0;} 補充:xyz換成abc 求最小同理

  • 中秋節和大豐收的關聯?
  • 為什麼現在有些年輕人越來越不想結婚了?