EECS 370 Discussion: Programming Languages as Cars and Examples

eecs 370 discussion n.w
1 / 20
Embed
Share

"Explore the concept of programming languages represented as cars, from a basic C racing car to a souped-up C++ version. Dive into examples of two's complement numbers and C vs. C++. Discover discussions on printf() examples and string representations. Engage with exciting topics like Embedded Systems and Space Stuff in this insightful EECS 370 Discussion session at Michigan Tech. Join to learn and discuss various programming language concepts."

  • EECS 370
  • Programming Languages
  • Twos Complement
  • C vs. C++
  • Examples

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. EECS 370 Discussion Programming Languages as cars C A racing car that goes incredibly fast but breaks down every fifty miles. C++ A souped-up version of the C racing car with dozens of extra features that only breaks down every 250 miles, but when it does, nobody can figure out what went wrong. Assembly You are the car. 1

  2. EECS 370 Discussion Undergrad at Michigan Tech Hougton, MI 2

  3. EECS 370 Discussion 3

  4. EECS 370 Discussion Excited By: Embedded Systems Space Stuff Mandolin Sci-Fi / Fantasy Come say hello during Office Hours 4

  5. EECS 370 Discussion Two s Complement Numbers 5

  6. EECS 370 Discussion Two s Complement Numbers Example: -37 in 8-bit two s complement binary 6

  7. EECS 370 Discussion Two s Complement Numbers Example: -37 in 8-bit two s complement binary Answer: 110110112 7

  8. EECS 370 Discussion Two s Complement Numbers Example: -37 in 8-bit two s complement binary Answer: 110110112 Question: -37 => 110110112 219=> 110110112 How do you know the difference? 8

  9. EECS 370 Discussion C vs C++ Not in C: Classes & Objects Namespaces New & Delete Cout & Cin Data Structures String datatype 9

  10. EECS 370 Discussion printf() Examples #include <stdio.h> int main( ) { printf("Hello World"); } #include <stdio.h> int i; for (i = 0; i < 10; i++) { printf( i= %d\n", i); } 10

  11. EECS 370 Discussion String Examples char* text = Hello ; Equivalent to char text[] = { H , e , l , l , o , \0 }; 11

  12. EECS 370 Discussion String Examples char* text = Hello ; char* copy; copy = text; Why is this wrong? 12

  13. EECS 370 Discussion String Examples char* text = Hello ; if (text == Hello ) { ... } Why is this wrong? 13

  14. EECS 370 Discussion malloc() Examples int *foo; foo = (int *) malloc(sizeof(int)); *foo = 5; ... free(foo); 14

  15. EECS 370 Discussion Bit Twiddling Examples char data = 87; How would you set the 6th bit of data? 15

  16. EECS 370 Discussion Bit Twiddling Examples char data = 87; How would you set the 6th bit of data? data |= (1<<6); also acceptable: data |= (0x40); 16

  17. EECS 370 Discussion Project 1 Overview 17

  18. EECS 370 Discussion Project 1 Overview Translate to binary: ADD 0 0 5 18

  19. EECS 370 Discussion Project 1 Overview Translate to binary: ADD 0 0 5 Opcode RegA RegB DestReg 0000000 0 00 000 000 00000000 00000 101 Equals: 0x00000005 Equals: 510 19

  20. EECS 370 Discussion Project 1 Overview ADD 0 0 5 --> 510 .fill 5 -------> 510 What s the difference? 20

Related


More Related Content