In my study,CSCI 1110 (Introduction
to Computing using C) is my first programming course.In my secondary school,I
did not have any experiences about computer programming.Although I am so worry
that C program will be so difficult to me – a beginner of learning
programming,I know that equipping good programming skill is very important to a
successful engineer.Therefore,I will make effort to study C program in the
coming semesterin order to acquire the skill of using C program thoroughly.
Part 1
1.1 Contents
of the lectures
In lecture 1, I have learnt some fundamental concepts about computers and programming, including
computer organization, computer languages and phases of C programs development.
Computer organization:
A computer mainly consists
of five component:
(1)
Input
unit:
Obtains information from input devicessuch as
Keyboard, mouse, microphone, scanner, network.
(2)
Output
unit:
Takes information processed by computer and places
information on output devices such as screen, printer, networks.
(3)
Central
processing unit (CPU):
CU (Control Units): Supervises
and coordinates other sections of computer
Arithmetic and logic unit (ALU): Performs
arithmetic calculations and logic decisions
(4)
Memory unit:
Rapid access, relatively low capacity “warehouse” section.
Retains information from input unit
Immediately available for processing.
(5)Secondary storage unit
Long-term, high-capacity “warehouse” section.
Store data and programs that are not
immediately needed.
More about computer organization
Computer languages:
These five key elements communicate with
each other, enabling a computer to operate normally.
Computer languages can be divided into
three types:
(1)
Machine Languages:
Only language computer directly understands.
Made up of 0s and 1s.
Instruct computers to perform elementary
operations.
(2) Assembly Languages:
English-like abbreviations representing
elementary computer operations
Easier for humans to read and write.
Incomprehensible to computers, require translator
programs (assemblers)to convert to machine language.
(3) High-level Languages:
More English-like, use common mathematical
notations.
Single statements accomplish substantial
tasks.
Translator programs (compilers) convert to
machine language.
In these languages, high level language is
the easieslanguage for humans to understand and edit. Therefore,many modern
computer programs are high level language, such as Basic, Pascal, C, C++, C#,
Java, Fortran, Perl, Lisp, Cobol, JavaScript.
More about these three languages :
Phases of C programs development:
The development of C programs includes six
phases:
Edit, preprocess, compile, link, load,
execute.
In lecture 2, I have learnt the general
form of a simple C program,the use of variables,the keywords of C program and
the output to the screen.
The
general form of a simple C program:
The general form of a simple C program is
usually :
#include<stdio.h.>
Int main(void)
{ ……
Return(0);
}
This includes a library called “stdio.h”
and a main function which contains the main operations to be executed.
The
use of variables:
Variable is a storage cell in the main
memory. Itcan be viewed as a box for holding some values. Depending on the type
of data it is storing, a variable can occupy one or more bytes.
The
keywords of C program:
Keyword is a word that has a strict
meaning.It cannot be redefined or used in other ways.C program has 32 keywords.
The output to the screen:
The statement–printf(“…”); is used to give a command of output to the screen.
For example,
The above program output the sentence “Hello,
world!” and “Hello, universe!” by two printfstatements.
1.2 Learning
Process:
As a beginner of C program, it is important
for me to spend more time on preparation and practices in order to learn it
efficiently.Before the lecture,I would read the whole lecture note one time to
have a better understanding in the lecture.When I meet difficultproblem,I would mark it down so that I can pay more
attention on this part during lecture.
Moreover, in order to get more information
for learning,I borrowed a book about C programming,called C : how to program.It is a guidebook for C program beginner.It introduces how to write C program step by
step with example. I think this reference book is very helpful for me to learn how to write C
program.
Moreover,I think the
best way for beginner to learn C program is to practice more.
In order to do so,I have installed
Microsoft Visual Studio 2012 in my computer and tried to do the C program exercises
at the tutorials and reference book.This gave me opportunities to apply the
knowledge learnt from the lesson into real applications.
Part 2
A interesting topic in the lesson –output
statement
A brief description about the topics :
As mentioned before,The statementprintf(“…”); is
used to give a command of output to the screen.
The below
code is the printf example at the lecture note:
The above program output the sentence “Hello,
world!” and “Hello, universe!” by two printfstatements.
My opinion, commends, ideas, and further information about output statement :
After seeing the above example at
the lecture note,I have two problems in my mind.
First,can I use one printf
statement to output the two sentences instead of using two printf statements?
After my testing,I find that if I
add write the statement printf (”sentence1\nsentence2”); , I can print two sentences in different
line.
I
think my method is better than the method in the lecrture note.It is because my
method can reduce the number of statements written in the program and therefore
make the whole program run
faster.From this example,I understand that knowledge in the lecture or book is
not the only correct answer.If we are willing to think more critically,we may
find some better solution.
The second problem in my mind is
that can a C program display characters/strings that are input by user?After surfingthe
wensite,I find that it can be done by using a scanf statement before a printf
statement.
Website about scanf and printf :
http://caterpillar.onlyfun.net/Gossip/CGossip/PrintfScanf.html
I think this application is
very useful and important in our real life.For example,Automated Teller
Machine (ATM) may ask customer to enter amount of money
they want to take by scanf and display the amount of money on the screen by
printf.
From this example,I understanding that program is
essential in our daily life.To be a good information engineer,I must acquire
the skill of using C program thoroughly,
In the coming lecture,I will
learn more advanced knowledge about C program.I will continue to make effort on
writing C program and hope that I can acquirea good skill of writing C program at the
end of this semester.
沒有留言:
張貼留言