280 likes | 397 Vues
Tutorial 1 – Car Payment Calculator and Guess the Number Application: Introducing Computers, the Internet and C++ Programming.
E N D
Tutorial 1 – Car Payment Calculator and Guess the Number Application: Introducing Computers, the Internet and C++ Programming Outline1.1 What Is a Computer?1.2 Computer Organization1.3 The Internet and the World Wide Web1.4 Machine Languages, Assembly Languages and High- Level Languages1.5 C++1.6 Java1.7 Fortran, COBOL, Pascal and Ada1.8 BASIC, Visual Basic, Visual C++ and .NET1.9 Key Software Trend: Object Technology1.10 Compiling and Running C++ Applications1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications1.12 Internet and Web Resources1.13 Wrap-Up
Objectives • In this tutorial, you will learn to: • Identify the characteristics of low-level and high-level programming languages. • Apply the basics of object-oriented programming. • Run your first C++ application. • Locate additional C++ information using the Internet.
1.1 What Is a Computer? • Computers • Perform arithmetic calculations much faster than people can • Computer programs and applications • Instructions for a computer’s actions • Also known as software • Computer devices (also known as hardware) • Examples include keyboard, screen, mouse, hard drive, memory, etc.
1.2 Computer Organization • Six units in a computer • Input Unit • Obtains information from various input devices such as keyboard or mouse • Output Unit • Places computer-processed information on output devices (making it available for use outside of the computer) • Memory Unit or Primary Memory • Usually volatile (data is lost after computer shuts off)
1.2 Computer Organization (Cont.) • Arithmetic Logic Unit • Performs arithmetic calculations and determines logic • Central Processing Unit • Oversees all computer activities • Secondary Storage Unit • Nonvolatile(data is retained after computer shuts off) • Long term
1.3 The Internet And the World Wide Web • ARPANET • Set up by the Advanced Research Projects Agency to network university research computers • Enabled quick and easy communication via e-mail • TCP/IP • Transmission Control Protocol • Rules for transferring data over the ARPANET • Ensured that “packets” of information were sent and received correctly • Internet Protocol • Rules for intercommunication between networks
1.3 The Internet And the World Wide Web (Cont.) • World Wide Web (WWW) • Hardware and software associated with Internet communication • HyperText Markup Language (HTML) • Communications format developed by Tim Berners-Lee • World Wide Web Consortium (W3C) • Founded by Berners-Lee to develop Internet technologies
1.4 Machine Languages, Assembly Languages and High-Level Languages • Machine Languages • Machine dependent “natural language” • Assembly Languages • Machine language is too slow • Assemblers convert assembly languages to machine languages • High-Level Languages • Compilers convert to machine languages • Linkers package machine language files • Interpreters run high-level programs directly • Instructions look like everyday English
1.5 C++ • Evolved from C • C evolved from B and BCPL • Developed by Bjarne Stroustrup in early 1980s • Widely used for operating systems • Originally used to create UNIX • Provides capabilities for object-oriented programs • Hybrid language • C style • Object-oriented style
1.6 Java • Designed by Sun Microsystems • For intelligent consumer-electronic devices • Gained popularity with the World Wide Web • Used for dynamic content and animation on Web Pages • Now used for large scale enterprise applications development, enhances functionality of Web servers, provide applications for consumer devices and more • Widely used object-oriented language
1.7 Fortran, COBOL, Pascal and Ada • Fortran (FORmula TRANslator) • Developed by IBM • Still used in engineering community • COBOL • Still used in business software • Pascal • Designed for teaching structured programming
1.7 Fortran, COBOL, Pascal and Ada (Cont.) • Ada • Sponsored by the Department of Defense • Named after Lady Ada Lovelace • First computer programmer
1.8 BASIC, Visual Basic, Visual C++ and .NET • BASIC • Beginner’s All-Purpose Symbolic Instruction Code • For simple programs and teaching novices • Visual BASIC • Simplified development of Windows applications • VB.NET, Visual C++ .NET and C# • Framework Class Library (FCL) • Designed for Microsoft’s .NET platform • Object-oriented languages • Visual C++ .NET is derived from C++
1.9 Key Software Trend: Object Technology • Objects • Represent real-world nouns • Attributes (properties) • Actions (behaviors or functions) • Procedural Programming Languages • Focus on actions instead of objects
1.10 Compiling and Running C++ Applications • Files • Source code files (.cpp) • Header files (.h) • Executable files (.exe) • Compilation • Turns high-level source code into machine language code • Command prompt • Allows text instructions to be given to the computer
Beginning directory for Windows 2000 1.10 Compiling and Running C++ Applications (Cont.) Figure 1.1 Command Prompt window in Windows 2000.
Beginning directory for Windows XP 1.10 Compiling and Running C++ Applications (Cont.) Figure 1.2 Command Prompt window in Windows XP.
1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications • Open Command Prompt • Start > All Programs > Accessories > Command Prompt • Change directories • Type cd C:\Examples\Tutorial01\CarPayment • Type cd C:\Examples\Tutorial01\GuessNumber • Run an application • Type CarPayment • Type GuessNumber
Note that the current directory changed 1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications (Cont.) Figure 1.3 Changing to the Car Payment Calculator application’s directory.
Executing the CarPayment application 1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications (Cont.) Figure 1.4 Running the Car Payment Calculator application.
1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications (Cont.) Figure 1.5 Car Payment Calculator with data entered.
Close box Results displayed in tabular format 1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications (Cont.) Figure 1.6 Car Payment Calculator application displaying calculation results.
Note that the current directory changed 1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications (Cont.) Figure 1.7 Changing to the Guess the Number application’s directory.
Executing the GuessNumber application 1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications (Cont.) Figure 1.8 Running the Guess the Number application.
1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications (Cont.) Figure 1.9 Entering an initial guess.
Application displays whether your guess is too high or too low 1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications (Cont.) Figure 1.10 Entering a second guess and receiving feedback.
Entering additional guesses Entering the correct guess 1.11 Test-Driving the Car Payment Calculator and Guess the Number Applications (Cont.) Figure 1.11 Guessing the correct number.
1.12 Internet and Web Resources • www.deitel.com • www.prenhall.com/deitel • www.softlord.com/comp • www.elsop.com/wrc/h_comput.htm • www.w3.org/History.html • www.netvalley.com/intval.html • www.ansi.org • www.cuj.com