c語言第三例

來源:互聯網
上載者:User

標籤:getch   main   輸出   a*   math.h   getc   put   span   return   

標準的輸入輸出函數:

putchar(輸出字元)

getchar(擷取輸入字元)

printf(格式輸出)

scanf(格式輸入)

puts(輸出字串)

gets(擷取輸入字串)

 

#include <studio.h>

#include<math.h>

int main(){

double a,b,c,disc,x1,x2,p,q;

scanf("%1f%1f%1f",&a,&b,&c);

disc=b*b-4*a*c;

p=-b/(2.0*a);

q=sqrt(disc)/(2.0*a);

x1=p+q,x2=p-q;

printf("x1=%7.2f\n x2=7.2f\n",x1,x2);

return 0;

}

 

 

#include <studio.h>

int main(){

char a=‘A‘ ,b=‘D‘,c=‘Y‘;

purchar(a);

purchar(b);

purchar(c);

purchar(\n);

return 0;

}

 

 

#include <studio.h>

int main(){

char a ,b,c;

a=getchar();   //從鍵盤輸入一個字元,送給變數a

b=getchar();

c=getchar();

purchar(a);  //將變數值輸出

purchar(b);

purchar(c);

purchar(\n);

return 0;

}

 

 

#include <studio.h>

int main(){

float a,b,c,t;

scanf("%f,%f,%f",&a,&b,&c);

if (a>b){

t=a;

a=b;

c=t;

}

if(a>c){

t=a;

a=c;

c=t;

}

if (b>c){

t=b;

b=c;

c=t;

}

printf("%5.2f,%5.2f,%5.2f\n",a,b,c);

return  0;

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

}

 

c語言第三例

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.