Tuesday, September 30, 2014

[Delivery] Struct

Bài 1: Write a C Program to store student data in a structure. The data should include student ID, name, course registered for, and year of joining. Write a function to display the details of students enrolled in a specified academic year. Write another function to locate and display the details of a student based on a specified student ID.



To do this,

a.       Define the structure to store the student details.

b.      Declare and initialize the structure with details of 10 students.

c.       Set a loop to display a menu for the operations to be performed.

d.      Accept the menu choice and invoke appropriate functions with the structure array as parameter.
e.       In the function to display students for a year, accept the year. Set a loop to check each student’s enrollment year, and display if it matches. At the end, allow the user to specify another year.
In the function to locate student details, accept the student ID. Set a loop to check each student’s ID, and display if it matches. At the end, allow the user to specify another student ID.

Code:

Thursday, September 25, 2014

[Delivery] Pass by references

Bài 1: 1. Viết hàm truyền vào 2 số nguyên bất kỳ, thực hiện đổi chỗ 2 số đóNguyên mẫu hàm như sau: void swap (int &number1, int &number2);




My code + result

[Delivery] Pass by value

Bài 1: Write a function which accepts an integer value as input, and returns an integer which is the cube of that input



My code + result

Tuesday, September 23, 2014

Test


[Delivery] Exercise function

Bài 1: 1. Write a C program that accepts a number and square the number with the help of a function.


To do this,

a. Declare a function.

b. Accept the number.
c. Pass the number to the function and return the square of that number

Function prototype: int cal_square(int number);


My code + result

Monday, September 22, 2014

[Delivery] Character array

Bài 1: Write a program which prints the letters in a char array in reverse order. For example, if the array contains {'c', 's', 'c', '2', '6', '1'}the output (to the terminal) should be "162csc".


My code + result

[Delivery] Number array

Bài 1: Write a program that asks the user to type 10 integers of an array. The program must compute and write how many integers are greater than or equal to 10.


My code + result 

Tuesday, September 16, 2014

[Delivery] Exercise do... while

WHILE

Bài 1: Declare a variable which has the age of the person. Print the user’s name as many times as his age.

My Code + result

Bài 2: The program displays even numbers from 1 to 30.


My Code + result

Bài 3: The program displays numbers from 10 to 0 in the reverse order.


My Code + result


Bài 4: The program will accept integers and display them until zero (0) is entered.

My Code + result


Bài 5: Find the factorial of a number.



 Hint:



  1. Get the number.
  2. To begin, set the factorial of the number to be one.
  3. While the number is greater than one
  4. Set the factorial to be the factorial multiplied by the number.
  5. Decrement the number.
  6. Print out the factorial



My Code + result



Bài 6:  Write a program to print the series 100, 95 , 90, 85,………., 5.


My Code + result


Bài 7:   Accept two numbers num1 and num2. Find the sum of all odd numbers between the two numbers entered .



Bài 8: Write a program to generate the Fibonacci series. (1,1,2,3,5,8,13,………)


My Code + result

Bài học rút ra:
  • Cấu trúc: do { statements; } while (condition;).
  • Thay vì viết a = a + b ta có thể viết a += b .
  • Thay vì viết a = a - 1 hay a = a + 1 ta có thể viết a-- hay a++ để giảm hay tăng lên 1 đơn vị .




[Delivery] Exercise for

FOR

Bài 1: Declare a variable which has the age of the person. Print the user’s name as many times as his age.



My Code + result

Monday, September 15, 2014

[Delivery] Exercise While

WHILE 

Bài 1: Declare a variable which has the age of the person. Print the user’s name as many times as his age


My Code + result

Sunday, September 14, 2014

[Delivery] More conditional

Bài 1: Declare two variables x and y. Assign values to these variables. Number x should be printed only if it is less than 2000 or greater than 3000, and number y should be printed only if it is between 100 and 500.





Flow Chart:
Flow Chart

[Delivery] More if

Bài 1: Write a program that accepts two numbers a and b and checks whether or not a is divisible by b.


Flow Chart: 

Flow Chart

Thursday, September 11, 2014

[Delivery] Exercise with ball.

Challenge: Bouncy Ball

My Code

Bài học rút ra
  • if statement : 
    • Cấu trúc: if ( condition ) { statement }

[Delivery] Exercise gets()/put().

Bài 1: Write a program to accept and add three numbers.


My Code

[Delivery] Using printf() and scanf()

Bài 1: Use the printf( )  statement and do the following


Print out the value of the integer variable sum

Print out the text string "Welcome", followed by a new line.

Print out the character variable letter

Print out the float variable discount

Print out the float variable dump using two decimal places




My Code 

  • Bước 1: Dùng int, char, float để tạo ra các biến như hình trên.
  • Bước 2: Dùng print() để in ra các thứ như đề bài yêu cầu, chú ý dùng control list như %d  %f  %.2f   \n
  • Lưu ý: %.2f là để viết số thập phân chỉ có 2 số sau hàng ĐƠN VỊ (2 decimal places). Tương tự nếu dùng %.4f thì sẽ có 4 số sau hàng ĐƠN VỊ (4 decimal places).

Wednesday, September 10, 2014

[Delivery] Exercise for datatype

Bài 1: Write a program display your information, for instance: Full-Name, Age, Address



  • Bước 1: Dùng lệnh printf() để in chữ mình muốn in ra. 
  • Bước 2: Dùng \n để cách xuống dòng khi in ra. 

Tuesday, September 9, 2014

[Delivery] Exercise for variable

Nội dung: Trong bài viết này mình sẽ làm số bài tập trong KhanAcademy ! Sử dụng một số câu lệnh Java để vẽ một vài hình ảnh đơn giản.

Bài 1: Challenge: Bucktooth Bunn


Nội dung: Mình sẽ viết một vài dòng code để Eye Tooth của con Bunny có thể tăng giảm kích thước.

Monday, September 8, 2014

[Delivery] Exercise for drawing

1. Write a pseudo code and draw a flowchart to accept a value in degrees Celsius and to convert it into Fahrenheit. [Hint: C/5 = (F-32)/9]


  • Flowchart


  • Pseudocode
BEGIN
INPUT C
F = (9/5 x C) + 32
DISPLAY F
END

2. Write a pseudo code and flowchart to accept a student’s marks in Physics, Chemistry, and Biology. The total of these marks as well as the average should be displayed.

  • Flowchart
  • Pseudocode
BEGIN
INPUT P, C, B
TOTAL = P + C + B 
AVERAGE = (P+C+B)/ 3
DISPLAY TOTAL, AVERAGE
END

3. Write flowchart to check a any number  (0-N), is it a prime?














[Delivery] How To Work (Flipped Learning)


Nội dung: 
  1. How do you learn each objective of this course? (mark of 2)
  2. What is advantage and difficulty when you apply this methodology? (mark of 3)
  3. What is the most important activity in this course? (mark of 4)
  4. Give your opinions about this methodology compared to what you have applied. (mark of 5)

Trả lời:
1. How do you learn each objective of this course


Flip learning là một phương pháp giảng dạy mới không theo kiểu truyền thống là học sinh ngồi trên lớp thụ động và nghe thầy cô giảng bài. Ở flip learning thầy cô chỉ là người dẫn dắt còn học sinh là nhân tố chính dẫn đến kết quả học tập. Cách học ở đây là học sinh được xem video của thầy cô giăng dạy ở bất cứ đâu và có thể làm ngay tại lớp để thầy cô hướng dẫn luôn.

Sunday, September 7, 2014

[Delivery] Ready Laptop

Nội dung:
  • Cài đặt và sử dụng Dia để vẽ biểu đồ để máy tính chạy "Hello World!"
  • Cài đặt và sử dụng Dev-C để viết lệnh cho máy tính in ra dòng chữ "Hello World!"
Bước 1: Download 2 phần mềm trên 
  • Dev-C: http://sourceforge.net/projects/orwelldevcpp/
    Dia: http://dia-installer.de/
Bước 2: Cài đặt Dia (Dev-C làm tương tự)
  • Mở Dia vừa down trên web
  • Click Next -> Next -> Finish 

[What] is FlowChart and Pseudocode

Flowchart 

What's Flowchart ?
Flowchart is a step-by-step diagram, decision map


Why use Flowchart ?
Help to describe complex situation, idea. 


When to use Flowchart ?
When you need to analyze, explain in step-by-step, planning a project

[How to] Use Excel

Step 1: Open Excel (duh !)

Step 2: Blacked out about 4 boxes, then click to "Merge & Center". Then write down "Mark of final exam":

Tuesday, September 2, 2014

Biography

Biography 

Chào các bạn,

Mình tên Hoàng ( Jimmy ). Mình sinh năm 95.

Tính tình mình rất hòa đồng, vui tính, vì bạn bè và nhiều lúc tính cách có thể hơi điên loạn tí ( mong mọi người thông cảm :P