ผลต่างระหว่างรุ่นของ "Ske algo lab/lab 1 notes"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
(หน้าที่ถูกสร้างด้วย ': ''This is part of ske algo lab'' '''Notes for lab 1''' In this lab, you will learn C++ by working on exercises. Tasks 01 - 07 ...')
 
 
(ไม่แสดง 1 รุ่นระหว่างกลางโดยผู้ใช้คนเดียวกัน)
แถว 12: แถว 12:
 
* 01 Hello, C++
 
* 01 Hello, C++
 
** Pay attention to the comments on ''namespaces'', i.e., the line <tt>using namespace std</tt>.
 
** Pay attention to the comments on ''namespaces'', i.e., the line <tt>using namespace std</tt>.
 +
 +
* 02 while loop
 +
** We use <tt>cin</tt> to read the data from the user.
 +
** Since we have <tt>using namespace std</tt> at the top, we can use <tt>cout</tt> to output integers and <tt>endl</tt> to force new line.
 +
 +
* 04 check_prime
 +
** This task shows how to define a function.  In C++, you have <tt>true</tt> and <tt>false</tt> for <tt>bool</tt> type.
 +
** You can use % to mod.
 +
 +
* 05 Next prime
 +
** In this task, you have to submit the source file.
 +
 +
* 06 Classic stars
 +
** You can use nested loops.  But you don't have to.  You can use functions to avoid writing nested loops.
 +
 +
* 08 Close enough
 +
** Example 1: pairs that are close are (15 - 10), and (15 - 21)
 +
** Example 2: pairs that are close are (1 - 6), and (6, 11)
 +
 +
* 09 Trucks
 +
** Read the task statement carefully.

รุ่นแก้ไขปัจจุบันเมื่อ 19:50, 5 สิงหาคม 2561

This is part of ske algo lab

Notes for lab 1

In this lab, you will learn C++ by working on exercises. Tasks 01 - 07 are simple tasks to familiarize you to C++ syntax. Tasks 08 - 10 are slightly more problem-solving tasks. As we proceed into the course, you will get more problem-solving tasks.

The following are additional notes for lab 1.

  • General notes:
    • Data types: you will see explicitly int and bool. You will also use string constant.
  • 01 Hello, C++
    • Pay attention to the comments on namespaces, i.e., the line using namespace std.
  • 02 while loop
    • We use cin to read the data from the user.
    • Since we have using namespace std at the top, we can use cout to output integers and endl to force new line.
  • 04 check_prime
    • This task shows how to define a function. In C++, you have true and false for bool type.
    • You can use % to mod.
  • 05 Next prime
    • In this task, you have to submit the source file.
  • 06 Classic stars
    • You can use nested loops. But you don't have to. You can use functions to avoid writing nested loops.
  • 08 Close enough
    • Example 1: pairs that are close are (15 - 10), and (15 - 21)
    • Example 2: pairs that are close are (1 - 6), and (6, 11)
  • 09 Trucks
    • Read the task statement carefully.