1 / 33

Ceng 230 Programming with C Tansel Dökeroğlu Computer Engineering Department Fall 2014

Ceng 230 Programming with C Tansel Dökeroğlu Computer Engineering Department Fall 2014 Web pages ceng230. ceng . metu .edu.tr http://www.ceng.metu.edu.tr/~e1451970/ tanseldoker @ yahoo .com.tr.

Download Presentation

Ceng 230 Programming with C Tansel Dökeroğlu Computer Engineering Department Fall 2014

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ceng 230 Programmingwith C Tansel Dökeroğlu ComputerEngineeringDepartment Fall 2014 Web pages ceng230.ceng.metu.edu.tr http://www.ceng.metu.edu.tr/~e1451970/ tanseldoker@yahoo.com.tr

  2. "All the high-school students will be taught the fundamentals of computer technology will become proficient in binary arithmetic and will be trained to perfection in the use of the computer languages “SciencefictionwriterIsaac Asimov's Predictions For 2014 From in 1960s

  3. • COMPUTER – Device capable of performing computations andmakinglogicaldecisions – Computers process data under the control of sets ofinstructionscalledcomputerprograms • Hardware – Variousdevicescomprising a computer – Keyboard, screen, mouse, disks, memory, CD-ROM, printer, andprocessingunits • Software – Programs that run on a computer – Microsoft Windows, Microsoft Office, Internet Explorer

  4. Conceptual Structure of a ComputerSystem

  5. CPU (CentralProcessingUnit) • Processandmanipulateinformationstoredin memory. • It can be divided into two units: CU (ControlUnit) and ALU (Arithmetic Logic Unit) • CU coordinates activities of the computer andcontrols other devices of computer. • ALU processes arithmetical and logicalinstructions.

  6. Bit andByte A bit is a single numeric value, either '1' or '0', that encodes a single unit of digital information. A byte is a sequence of bits; usually eight bits equal one byte. Byte = 8 bits KiloByte (KB) = 1,024 Bytes MegaBytes (MB) = 1,024 KB GigaByte (GB) = 1,024 MB TeraByte (TB) = 1,024 GB

  7. Memory • Storeinformation (data + instructions) • A sequence of memory cells. • Store, retrieve, update – changing the pattern of 0 and 1s in memory cells – copying these patterns into some internal registers • Stored information in memory is volatile.

  8. BinarySystem • Hardware can only deal with binary digits, 0 and 1. • Must represent all numbers, integers or floating point, positive or negative, by binary digits, called bits. • Can devise electronic circuits to perform arithmetic operations: add, subtract, multiply and divide, on binary numbers.

  9. BinarySystem • Decimal system: made of 10 digits, {0,1,2, . . . , 9} 41 = 4×101 + 1×100 255 = 2×102 + 5×101 + 5×100 • Binary system: made of two digits, {0,1} 00101001 = 0×27 + 0×26 + 1×25 + 0×24 +1×23 +0×22 + 0×21 + 1×20 =32 + 8 +1 = 41 11111111 = 255, largest number with 8 binary digits, 28-1

  10. ASCII Table American Standard CodeforInformationInterchange

  11. History of C • C – Developed by Denis M. Ritchie at AT&T Bell Labs in 1972 as a systems programming language – Used to develop UNIX – Used to write modern operating systems – Hardware independent (portable) • Standardization – Many slight variations of C existed, and were incompatible – Committee formed to create a "unambiguous, machineindependent“ definition – Standard created in 1989, updated in 1999

  12. Other High-level Languages – C++ • Superset of C, and provides object-oriented capabilities – Java • Create web pages with dynamic and interactive content – Fortran • Used for scientific and engineering applications – Cobol • Used to manipulate large amounts of data – Pascal • Intended for academic use

  13. Flow chart of a program (Algorithm) In mathematics and computer science, an algorithmis a step-by-step procedurefor calculations.

  14. C language developmentenvironment

  15. Devc++ to write C code http://www.bloodshed.net/devcpp.html

  16. printf( "Welcome to \%d", (3/2) ); Output is : 1

  17. ! exclamation mark

  18. The C Standard Library • C programs consist of pieces/modules called functions – A programmer can create his own functions time consuming – Programmers will often use the C library functions Use these as building blocks – Avoid re-inventing the wheel If a pre-made function exists, generally best to use it ratherthan write your own Library functions carefully written, efficient, and portable

  19. Use searchengineswhile studying

  20. Usefullinks http://www.programmingsimplified.com/c-program-examples http://www.tutorialspoint.com/cprogramming/ http://www.wikihow.com/Learn-to-Program-in-C http://www.programiz.com/c-programming/examples

  21. Homework • InstallBloodshedC++ compilertoyourcomputer • Write a C program thatprintsyour name, surnameand mail adresstothescreen. • Sendthe C file tomyaddress (tanseldoker@yahoo.com.tr) • Untilnextweek

More Related