Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C++
C++
  1. ประเภทของตัวดำเนินการ (Operators) ใน C++

    ใน C++ มีตัวดำเนินการหลายประเภท สามารถจัดกลุ่มได้กว้างๆ ดังนี้: arithmetic, relational, logical, bitwise, assignment และ operators อื่นๆ ตัวดำเนินการเลขคณิต (Arithmetic Operators) สมมติตัวแปร A มีค่า 10 และ B มีค่า 20 ดังนี้: ตัวดำเนินการคำอธิบาย +บวกสอง operands: A + B จะได้ 30 -ลบ operand ตัวท

  2. IDE อันดับหนึ่งสำหรับ C++ บน Windows คืออะไร?

    การจัดการโปรเจกต์ขนาดใหญ่ด้วยเพียง text editor ทำได้ยาก คุณจะทำงานได้มีประสิทธิภาพมากขึ้นและไม่รู้สึกหงุดหงิด หากใช้ IDE ในกรณีเหล่านี้ มี IDE หลายประเภท คุณควรเลือกเครื่องมือที่เหมาะกับความต้องการ นี่คือรายการ IDE C/C++ ที่ดีที่สุดสำหรับ Windows: Visual Studio – IDE ที่พัฒนาโดย Microsoft มีเครื่อง

  3. IDE อันดับหนึ่งสำหรับ C++ บน Linux คืออะไร?

    การจัดการโปรเจกต์ขนาดใหญ่ด้วยเพียง text editor ทำได้ยาก คุณจะทำงานได้มีประสิทธิภาพมากขึ้นและไม่รู้สึกหงุดหงิด หากใช้ IDE ในกรณีเหล่านี้ มี IDE หลายประเภท คุณควรเลือกเครื่องมือที่เหมาะกับความต้องการ นี่คือรายการ IDE C/C++ ที่ดีที่สุดสำหรับ Linux: NetBeans for C/C++ Development – NetBeans เป็น IDE ฟร

  4. ตัวดำเนินการเลขคณิต (Arithmetic Operators) ใน C++

    C++ มีตัวดำเนินการเลขคณิตพื้นฐาน 5 ตัว คือ: บวก (+) ลบ (-) หาร (/) คูณ (*) โมดูลอหรือเศษ (%) ตัวอย่าง ตัวดำเนินการเหล่านี้สามารถใช้งานกับการดำเนินการเลขคณิตใดๆ ใน C++ มาดูตัวอย่างกัน: #include <iostream> using namespace std; int main() { int a = 21; int b = 10; int c; c = a +

  5. IDE สำหรับ C++ บน Linux ใดดีที่สุด?

    การจัดการโปรเจกต์ขนาดใหญ่ด้วยเพียง text editor ทำได้ยาก คุณจะทำงานได้มีประสิทธิภาพมากขึ้นและไม่รู้สึกหงุดหงิด หากใช้ IDE ในกรณีเหล่านี้ มี IDE หลายประเภท คุณควรเลือกเครื่องมือที่เหมาะกับความต้องการ ไม่มี IDE ที่ดีที่สุด เพียงตัวเดียวสำหรับ C++ บน Linux คุณต้องเลือกเครื่องมืออย่างมีสติ นี่คือรายการ I

  6. ตัวดำเนินการเชิงสัมพันธ์ (Relational Operators) ใน C++

    ในการเขียนโปรแกรม C++ ค่าที่เก็บในตัวแปรสองตัวสามารถเปรียบเทียบกันได้โดยใช้ตัวดำเนินการต่อไปนี้ เพื่อกำหนดความสัมพันธ์ระหว่างพวกเขา ตัวดำเนินการเหล่านี้เรียกว่า ตัวดำเนินการเชิงสัมพันธ์ (Relational Operators) ตัวดำเนินการเชิงสัมพันธ์ใน C++ ที่มีอยู่คือ: ตัวดำเนินการคำอธิบาย >มากกว่า >=มากก

  7. IDE สำหรับ C++ บน Windows ใดดีที่สุด?

    การจัดการโปรเจกต์ขนาดใหญ่ด้วยเพียง text editor ทำได้ยาก คุณจะทำงานได้มีประสิทธิภาพมากขึ้นและไม่รู้สึกหงุดหงิด หากใช้ IDE ในกรณีเหล่านี้ มี IDE หลายประเภท คุณควรเลือกเครื่องมือที่เหมาะกับความต้องการ ไม่มี IDE ที่ดีที่สุด เพียงตัวเดียวสำหรับ C++ บน Windows คุณต้องเลือกเครื่องมืออย่างมีสติ นี่คือรายการ

  8. วิธี Edit, Compile และ Execute โปรแกรม C++

    ขั้นตอนการสร้างและรันโปรแกรม C++ 1. สร้าง Source File สร้างไฟล์ source.cpp ด้วย text editor: #include <iostream> int main() { std::cout << Hello world; } 2. Compile ด้วย GCC (g++) $ cd C:/Users/Dell/Documents # ไปที่โฟลเดอร์ source $ g++ -o myprogram source.cpp # compile สร้าง

  9. Logical Operators ใน C++

    Logical Operators 3 ตัว Logical OR (||) Logical AND (&&) Logical NOT (!) Logical OR (||) True ถ้า operand ไหนก็ตามเป็น true Short-circuit: operand ที่ 2 ประเมินเฉพาะ operand แรกเป็น false Left-to-right associativity Operands: integral/pointer type (มักเป็น relational/equality expressions) Log

  10. Bitwise Operators ใน C++

    Bitwise Operators 3 ตัว Bitwise AND (&) Bitwise OR (|) Bitwise XOR (^) ทั้งหมดต้องการ integral types 1. Bitwise AND (&) เปรียบเทียบ bit แต่ละคู่: ทั้งคู่เป็น 1 → ผล 1, มิฉะนั้น 0 unsigned short a = 0x5555; // 0101... unsigned short b = 0xAAAA; // 1010... cout << hex << (a &am

  11. Assignment Operators ใน C++

    ประเภทการ Assign Simple assignment: e1 = e2 เก็บค่า e2 ไว้ใน e1 Compound assignment: e1 op= e2 คำนวณ op แล้วเก็บผลใน e1 Simple Assignment Example #include <iostream> using namespace std; int main() { int i; i = 10; // simple assignment cout << i; return 0; } 10 Com

  12. Unary Operator ใน C++

    นิยาม Unary operator ทำงานกับ operand เดียว สร้างค่าใหม่ รายการครบ: Operatorคำอธิบาย Indirection (*)Dereference pointer คืน l-value ที่ address Address-of (&)ได้ address ของ operand (function designator หรือ l-value) Unary plus (+)คืนค่า operand ต้องเป็น arithmetic type Unary negation (-)ท

  13. Sizeof Operator ใน C++

    นิยาม sizeof เป็น keyword แต่เป็น compile-time operator หาขนาดใน bytes ของ variable หรือ data type Syntax sizeof (data type) รองรับ classes, structures, unions, user-defined types กฎพิเศษ sizeof(char) เสมอ = 1 Array → ขนาดทั้งหมดใน bytes (ไม่ใช่ขนาด pointer) ตัวอย่าง #include <iostream>

  14. Ternary Operator (? : ) ใน C++

    นิยาม Conditional operator ? : เป็น ternary operator (3 operands) การทำงาน Operand แรกแปลงเป็น bool ประเมินเสร็จก่อน True → ประเมิน operand ที่ 2 False → ประเมิน operand ที่ 3 ผลลัพธ์ = ค่าของ operand ที่ประเมิน (ตัวที่ 2 หรือ 3) มีเพียงหนึ่งตัวที่ถูกประเมิน Associativity: right-to-left กฎชนิดข

  15. Comma Operator (,) ใน C++

    วัตถุประสงค์ Comma operator ใช้ต่อข้อความนิพจน์หลายตัวเข้าด้วยกัน ค่าของ comma-separated list คือค่าของ ข้อความนิพจน์ตัวสุดท้าย (rightmost) ข้อความนิพจน์อื่นๆ จะถูกประเมินแต่ค่าถูกทิ้ง ตัวอย่าง #include <iostream> using namespace std; int main() { int i, j; j = 10; i = (j++, j +

  16. Dot Operator (.) ใน C++

    บทนำ ) ใช้เข้าถึงสมาชิก class/struct/union สถานการณ์ต่างกัน กฎการใช้งาน a.b: b เป็นสมาชิกของ object/reference a (a ต้องเป็น object จริง) b: shorthand ของ (*a).b a เป็น pointer Overloadability . ไม่ overload ได้ overload ได้ ตัวอย่าง b << \n; return 0; } ผลลัพธ์ b = 5 หมายเหตุ: เ

  17. Arrow Operator (->) ใน C++

    บทนำ ) ใช้เข้าถึงสมาชิก class/struct/union (class type) สถานการณ์ต่างกัน กฎการใช้งาน a.b: b เป็นสมาชิกของ object/reference a (a ต้องเป็น object จริง) b: shorthand ของ (*a).b a เป็น pointer ไป object เข้าถึง b ของ object นั้น Overloadability . ไม่ overload ได้ overload ได้()) ใช้ใน smart point

  18. Casting Operators ใน C++

    นิยาม Cast เป็น special operator บังคับแปลงชนิดข้อมูล เป็น unary operator precedence เท่ากับ unary operators อื่นๆ รูปแบบทั่วไป (C-style cast) (type) expression C++ Casting Operators (เฉพาะเจาะจงกว่า) Operatorวัตถุประสงค์ const_cast<type>(expr)Override const/volatile attributes เปลี่ยน

  19. Pointer Operator & (Address-of) ใน C++

    Pointer Operators ใน C++ C++ มี pointer operators 2 ตัว: Address-of Operator (&) Indirection Operator (*) Address-of Operator (&) Complement ของ * เป็น unary operator คืน address ของ operand (r-value) ตัวอย่าง (เหมือนกับ Indirection operator) #include <iostream> using namespace st

  20. Pointer Operator * (Indirection) ใน C++

    Pointer Operators ใน C++ C++ มี pointer operators 2 ตัว: Address-of Operator (&) Indirection Operator (*) Pointer คือตัวแปรที่เก็บ address ของตัวแปรอีกตัว point to ตัวแปรนั้น ชนิดข้อมูลอะไรก็ได้ (object, struct, pointer อีกตัว) Indirection Operator (*) Complement ของ & เป็น unary operat

Total 6007 -คอมพิวเตอร์  FirstPage PreviousPage NextPage LastPage CurrentPage:5/301  20-คอมพิวเตอร์/Page Goto:1 2 3 4 5 6 7 8 9 10 11