題目正文
撰寫一個C程式,要求在螢屏上輸出以下資訊, This is my first c program!
Input
無
Output
This is my first c program!
Sample Output
This is my first c program!
題解
C 語言中的 I/O (輸入/輸出) 通常使用 printf() 和 scanf() 兩個函式,
scanf() 函式用于從標準輸入(鍵盤)讀取并格式化, printf() 函式發送格式化輸出到標準輸出(螢屏),
AC代碼
1 #include<stdio.h> 2 int main() 3 { 4 printf("This is my first c program!"); 5 return 0; 6 }
提示
所有的 C 語言程式都需要包含 main() 函式, 代碼從 main() 函式開始執行,
printf() 用于格式化輸出到螢屏,printf() 函式在 "stdio.h" 頭檔案中宣告,stdio.h 是一個頭檔案 (標準輸入輸出頭檔案)
#include 是一個預處理命令,用來引入頭檔案,
當編譯器遇到 printf() 函式時,如果沒有找到 stdio.h 頭檔案,會發生編譯錯誤,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/254734.html
標籤:其他
