完全不懂自己學麼東西的程設
不過還是快點把.....自己弄得東西貼上來
之後慢慢弄懂了啦
這樣貼,可以分別設定好杯數、價格?!
#include<stdio.h>
int main(void)
{
int coffee=80, tea=30;
int cup=1;
printf("%d cup of coffee is %d dollar\n",cup,coffee);
printf("%d cup of tea is %d dollar\n",cup,tea);
return 0;
}
這樣即使漲價也不用定義來定義去?!
#include<stdio.h>
int main(void)
{
int coffee=80;
int cup=1;
printf("%d cup of coffee is %d dollar\n",cup,coffee);
coffee=70;
printf("now we sale %d cup of tea is %d dollar\n",cup,coffee);
return 0;
}
然後這麼做就可以把想運算的東西一次表達了
#include<stdio.h>
int main(void)
{
int total;
total=1+2+3+4+5+6+7+8+9+10;
printf("1~10 total are %d",total);
return 0;
}
還有要把變數交換值,就要這麼做
#include<stdio.h>
int main(void)
{
int a,b,c;
a=10;
b=20;
printf("變化前a=%d,b=%d\n",a,b);
c=a;
a=b;
b=c;
printf("變化後a=%d,b=%d\n",a,b);
return 0;
}
好怪的大小寫轉換
為什麼大寫反而比小寫的值來得小?
#include<stdio.h>
int main(void)
{
char big='H',small;
small=big+32;
printf("%c 的小寫要寫成這樣%c\n",big,small);
return 0;
}