or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Software Tutorial 1 - Classwork
Identify Errors
The following code includes several errors. Identify the errors and correct them such that the code can be compiled.
Your correct code should give the following output:
Swapping Contents
Implement your code such that the values of
a
andb
are swapped.Introduce Yourself
Add a print statement below such that
GPA
andyear
are printed.Example Output
Introduce Yourself (Interactive)
This time you are required to implement an interactive program. The program should ask for your current GPA and current year, save the information into the corresponding variables, then print the variables on a new line.
Example Output
What is your GPA:
andWhat is your year:
should be printed by your program.Reminder
Introduce Yourself
.GPA
?scanf
reads the console input and save the information to variablesscanf
…Matrix Addition
A matrix is a rectangular arrangement of numbers into rows and columns. Each number in a matrix refers to a matrix element.
To perform matrix addition, you need to have two matrices of the same size. Then you can sum up the entries respectively.
Example:
We call the matrix above a \(3 \times 2\) matrix with entries \(a_1\) to \(a_6\).
Now, given another \(3 \times 2\) matrix \(B\):
Since the size of A and B are the same, we can perform matrix addition:
Task
Implement the code to perform \(3 \times 2\) matrix addition.
First Word
In the tutorial, we mentioned that
(space character). You should remove / not display the characters afterwards.
\0
is a special charater that indicates the end of a char array. In this question, you are required to print the first word found in the char array. That is, you should only print up to the firstExample
Input:
Danny is lonely.
Output:
Danny
Input:
Chalex is handsome.
Output:
Chalex
Skeleton Code
Tips
Area of circle
Construct a function called
circleArea
to calculate the area of a circle usingfloat
s. Modify the following code: