C 語言入門

Hello World

#include<stdio.h>

int main()
{
    printf("Hello World!\n");
    return 0;
}

Hello World

#include<stdio.h>

int main()
{
    printf("Hello World!\n");
    return 0;
}

標頭檔

Hello World

#include<stdio.h>

int main()
{
    printf("Hello World!\n");
    return 0;
}

程式主體

Hello World

#include<stdio.h>

int main()
{
    printf("Hello World!\n");
    return 0;
}

印出 Hello World

Hello World

#include<stdio.h>

int main()
{
    printf("Hello World!\n");
    return 0;
}

printf

函數

Hello World

#include<stdio.h>

int main()
{
    printf("Hello World!\n");
    return 0;
}

字串

Hello World

#include<stdio.h>

int main()
{
    printf("Hello World!\n");
    return 0;
}

程式結束

Hello World 2

#include<stdio.h>

int main()
{
    printf("%s", "Hello World\n");
    return 0;
}

印出 Hello World

變數

#include<stdio.h>

int main()
{
    int number;
    printf("Please input an integer:\n");
    scanf("%d", &number);
    printf("The integer you inputed is:\n");
    printf("%d\n", number);
    return 0;
}

變數

宣告變數

#include<stdio.h>

int main()
{
    int number;
    printf("Please input an integer:\n");
    scanf("%d", &number);
    printf("The integer you inputed is:\n");
    printf("%d\n", number);
    return 0;
}

變數

scanf 函數

讀取輸入至變數

#include<stdio.h>

int main()
{
    int number;
    printf("Please input an integer:\n");
    scanf("%d", &number);
    printf("The integer you inputed is:\n");
    printf("%d\n", number);
    return 0;
}

變數

印出變數內容

#include<stdio.h>

int main()
{
    int number;
    printf("Please input an integer:\n");
    scanf("%d", &number);
    printf("The integer you inputed is:\n");
    printf("%d\n", number);
    return 0;
}
Made with Slides.com