C ++ for beginners and C language for beginners
I learned c a long time ago, but I forgot about it. Recently I am engaged in JNI and studied c ++. I found that it is very similar to Java.
I just printed a 9-9 multiplication table with c ++. Haha
// Print the multiplication table
Void printMultiplication (){
For (int I = 1; I <10; I ++ ){
For (int j = 1; j <= I; j ++ ){
Cout <j <"*" <I <"=" <(j * I) <"\ t ";
}
Cout <endl;
}
}
The effect is as follows:
1*1 = 1
1*2 = 22*2 = 4
1*3 = 32*3 = 63*3 = 9
1*4 = 42*4 = 83*4 = 124*4 = 16
1*5 = 52*5 = 103*5 = 154*5 = 205*5 = 25
1*6 = 62*6 = 123*6 = 184*6 = 245*6 = 306*6 = 36
1*7 = 72*7 = 143*7 = 214*7 = 285*7 = 356*7 = 427*7 = 49
1*8 = 82*8 = 163*8 = 244*8 = 325*8 = 406*8 = 487*8 = 568*8 = 64
1*9 = 92*9 = 183*9 = 274*9 = 365*9 = 456*9 = 547*9 = 638*9 = 729*9 = 81
C language for beginners. Can you help me?
After reading the answer from clibuwei, the answer is pretty good. I want to explain "B) variables in C can be defined anywhere before use", which is correct. There is a scope issue.
Take the answer as an example:
Main (){
Int I = 0;
Printf ("% d", I );
Int j = 1;
Printf ("% d", I );
}
// This program is indeed incorrect. Because j is in the main function body, that is, the scope is the main function.
Main (){
Int I = 0;
Printf ("% d", I );
{
Int j = 1;
Printf ("% d", j );
}
}
// Note that I have added curly braces. This program is acceptable. The scope of variable j is printf ("% d", j );
// Hope to help you
What books should I use for beginners in C language?
First of all: C language is relatively simple to get started, but if you want to become a good C programmer, you need to train hard, read more code, practice more, operate more on the computer, and think more, learning is a hard task. You have to give up a lot of things and stick to it. It can be said that C language is the foundation and you will want to learn other C ++ and JAVA in the future, if there is a C foundation, it is better to get started.
C language is widely used. It can be said that anyone proficient in computer has mastered C language. I am a computer Major in undergraduate courses. C is used as the first course of many courses without the basics of C language, you cannot learn core courses, such as data structures, operating systems, compilation principles, and computer networks, development, design, etc.) must master the C language.
C Traps And Pitfalls recommend reading, but there must be a foundation.
If you recommend C Primer Plus or C In A Nutshell at the beginning.
I went to the bookstore to buy the translation version of the book, the red one. The original is foreign.
If you can directly read the original English version (after all, the translation is somewhat surprising ).
<21 days learning C language> (Sixth Edition)
Bradley L. Jones, Peler Aitken.
Cinda studio translation.
People's post and telecommunications Publishing House
This book is good for beginners. It would be better if it had a basic knowledge.
It is recommended that you select the Book of Tan haoqiang, which is easy to learn and works well in combination with theory and practice. If you can learn it carefully, you will find that your C language is very basic.
It doesn't mean that other books are not good, but some books are just for readers to get started and there is no future.
Read tan haoqiang's C language programming, which is recognized as a Chinese entry-level teaching material. But the code style in the book is not flattering. After reading this book, I recommend "21 days learning C language". This book is good and personal. After reading these two books, you can grade C ++.
C language can only lay a good foundation. If you want to be proficient, it is better to be proficient in C ++, which is promising. But don't rush.
The following is a learning track I suggest for another beginner programming friend. You can refer to the following:
It is not expensive to learn programming languages, and you must step by step.
When learning a language, it basically starts with the C language.
A copy of "C language programming" By Tan haoqiang is sufficient.
However, during the learning process, please be careful not to learn the programming style of the old man! I don't know if the version is changed now. When I was studying this book, the above Code style made me very bad.
For a good C language code style, see 21-day learning C language.
It takes up to half a year to learn C. It's almost the same. Just make a decent small project and test yourself. Then we should step into C ++. C ++ is a language worthy of in-depth research. If you learn it carefully, you will find it powerful. There are also many classic design ideas. The entry-level book C ++ University self-study course is well-understood, but thick. It is more profound to recommend the class C ++ language for in-depth research. I highly recommend Overseas Famous books such as "Meditation of masters of C ++", which are very dizzy.
Java must be learned, but if you do not want to develop in this area, you can not be so tired. Java is one of the most rapidly developing languages, and its technology is updated fast, far ahead of our learning speed. The focus of learning Java is to learn her thoughts. Learn the object-oriented thinking and the ideas of various frameworks and architectures built on it. After learning C ++, I will learn Java again. The syntax part is sufficient for 10 days, but the thought part depends on your understanding.
Additional suggestion: After learning C ++ and Java, I will go back to the C language and study how to implement four main object-oriented features (abstraction, encapsulation, inheritance and polymorphism) using C language ). At this point, you will find that, oh, the mysterious things seem like this before ......
After you have gone through the above three languages, you can choose your desired direction for further study. At that time, you already knew. At this time, it is easy for you to learn any other programming language. This is the basic function.
<Programming Pearl>-China Power Press
<Cheng ...... remaining full text>