Warum tut man sich das an Oder warum
- Slides: 15
Warum tut man sich das an? Oder: warum lernt man C? Versuch einer (befriedigenden? ) Antwort: http: //www. depik. com/php/how_to_learn_c. php Oder kurz ‘reinschauen in einen realen Kurs aus der California Polytechnic State University: 1
…eine Quelle von Information: 2
Aus: CSC-234 C and UNIX (for non-majors) Summer Quarter 2001 and after Instructor: Mark S. Hutchenreuther 3
CSC-234 Lecture 19 Programmer’s Toolbox Other Languages 4
Today’s Topics • Tools at your disposal. • The C family of languages. 5
Discipline, Etc. • This course was intentionally rigorous and structured. • C, or any other language is all about: – Syntax – the form of statements. – Semantics – the meaning of those statements. • A lot of time was spent on “style” issues. • Consistent style leads to fewer programming errors and less frustration. • What you ultimately learned was simply discipline 6
Syntax • Given the following statement: for (i. Loop = 1; i. Loop <= 10; i. Loop++) {…} • Str u ctuform of the statement: Syntax refers (likto the r a – An arithmeticeinitialization expression. l „ e W l – A logical test expression. ord eme nts – An arithmetic incrementing s“expression. ) – All separated by semicolons. 7
Semantics • Semantics refers to the meaning of the statement: – Variable i. Loop is initially set to 1, and the test expression is true, since i. Loop <= 10. – The statements in the loop, {…}, are executed. – At the end of the loop, variable i. Loop is incremented. – Variable i. Loop is compared to 10. • Th e (lik „us age e • If it is less than„or. G equal to that, “the loop is executed again. ; rathemloop terminates. • If it is greater than that, ma comment In Assembler A 51: djnz variable; r“)<= 10; i. Loop++) instead of for (i. Loop = 1; i. Loop 8
The Tool Problem • Old Adage: – When your only tool is a hammer, every problem looks like a nail. • Fortunately, the hammer is not your only tool. 9
Programmer’s Toolbox • Top area – basic data types, arrays, and strings. • First drawer – basic program elements, input, output, and files. • Second drawer – branching and looping constructs. • Third drawer – functions and pointers. • Fourth drawer – miscellaneous elements, like structures and enumerations. • Documentation – headers. 10
Using the “Proper” Tool • Given the need to open a switch plate on your wall: – A wrench won’t help, nor will pliers. – Your fingernail probably isn’t strong enough. – A knife might work. – You can break the plate off with a hammer, but only if the plate is plastic. • For this task, you need a screwdriver. 11
Introduction to C++ • C++ is to object-oriented programming as C is to functional decomposition. However, C++ really is just an increment of C. • C++ uses input and output “streams” rather than scanf() and printf(). • C++ has a basic string data type, and a Boolean data type, and a better way of passing by reference. • C++ has a better way of delimiting comments. • Most importantly, C++ extends the concept of a structure to that of a class. 12
Input and Output Streams • Input/output in C: – scanf (“%f”, &f. Cels); – printf (“%f deg. C is %f deg. F. n”, f. Cels, f. Fahr); • Input/output in C++: – cin >> f. Cels; – cout << f. Cels << “ deg. C is “ << f. Fahr << “ deg. F. ” << endl; • Input is much easier with cin than with scanf(). • The problems come with formatted output, which is actually easier with printf() than cout. 13
Why Learn C? • Learning C is like learning Latin, you are learning the root language for many other languages. • The world is written in C, including both UNIX and Windows 2000. • It’s hardly a simple language, but learning its concepts enables you to learn and use virtually any other language, such as C++, Java, Perl, and even C#. Today’s Lessons • You have a lot of tools at your disposal, enough to create very complex and powerful programs. • You have learned discipline and style. • You have learned structured programming. • You learned the root language of several other languages. • You can easily learn another language derived from C, such as C++ or Java. 14
Ergänzung um die Hardware. Relevanz http: //www. cc 5 x. de/ http: //chaokhun. kmitl. ac. th/~kswichit/ 15
- External conflict man vs society
- Warum fühlen sich laugen seifig an
- Akkusativ ich mich du dich
- Mich dich sich uns euch sich
- Warum verletzt man menschen, die man liebt sprüche
- Personalpronomen im akkusativ
- Wo befindet sich das ruhrgebiet
- Rettungsgass
- Karneval season
- Warum feiert man weinachten
- Asas pendidikan alam takambang jadi guru
- King tut tomb
- Etba12
- Tut software development
- King tut mummy
- Amenhotop