2010年1月30日 星期六

C程式語言-《 printf 》《scanf》的用法及格式 How-to: printf and scanf Basics

《printf》的格式(Format):

#include

int main(void)

{
printf("hello, Welcome to Teaching Information blog!!\n");

}

--------------------------------------------------------------------------

顯示的效果:



--------------------------------------------------------------------------

《scanf》的格式(Format):

#include

int main(void)
{
int a;
int b;
printf("Enter a and b are:\n");
scanf("%d %d" ,&a, &b);
printf("X=%d, Y=%d", a, b);
}

-------------------------------------------------------------------------------

輸入a=1, b=2 后的效果:



-------------------------------------------------------------------------------
Video (How-to: printf and scanf Basics)