1 //++++++++++++++++++++++++++
2 // HelloVar.cpp
3 //++++++++++++++++++++++++++
4
5 ///#include headers
6 #include <iostream>
7
8 ///USING
9 using namespace std;
10
11 ///mainentry
12 int main()
13 {
14 ///declare variables
15 int iMyInt = 88; // Integer
16 float fMyFloat = 1.68; // Floating point number
17 char cMyChar = 'A'; // Character
18 string sMyString = "my text string "; // txt string
19 char caMyString[] = "my character array"; // txt string
20
21 ///Display variables
22 cout << "Int = " << iMyInt << endl;
23 cout << "Float = " << fMyFloat << endl;
24 cout << "Char = " << cMyChar << endl;
25 cout << "String = " << sMyString << endl;
26 cout << "CharArray = " << caMyString << endl;
27
28 ///mainend
29 return 0;
30 }//end main()
31
This Blog is dedicated to Sir Johnson Lin
C++ 基本 顯示各類資料型態功能 C++ basic Display multi-data , different variables
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言