// C++ sample #include // ヘッダファイルは stdio.h ではない using namespace std; // 名前空間という概念(おまじない) int main() { // 入出力はストリームを使う cout << "Hello" << endl; // cout(標準出力へのストリーム)に出力するものを流す // endl はC言語の \n と同じ。改行を表す。 cout << "正の整数を入力:"; int x; // どこでも宣言可能 cin >> x; // cin(標準入力ストリーム)から変数に入力 for(int i=1; i<=x; i++){ // どこでも宣言可能 cout << i << " "; } cout << endl; return 0; }