Presentation is loading. Please wait.

Presentation is loading. Please wait.

Information Technology for Engineers

Similar presentations


Presentation on theme: "Information Technology for Engineers"— Presentation transcript:

1 Information Technology for Engineers
FE11A/ENGR1001 Recap

2 FE11A/ENGR1001 Mid Term When: Thursday 3rd November, 2005.
When: 1:30pm – 4:00pm. Where: MD2 & MD3 – Civil Building. Group 1: MD2. Group2: MD3. Group 1 –Mechanical, Chemical. Group 2 – Civil, Surveying, Geosciences.

3 Proper IDE Usage

4 Break

5 Control Structures Sequence; Selection; Repetition; Invocation.

6 Sequence

7 Comments // Single line Comments Block Comments /* Program Name
Description Assumptions */

8 Preprocessor Commands
Header Files #include <iostream.h> Types of Header Files <iostream.h> <stdlib.h> <math.h> <iomanip.h> <string.h>

9 Main Functions int main() void main()

10 int main int main() { Statements; return 0; }

11 void main void main() { Statements; return; // not always necessary }

12 Pseudocode BEGIN / START statements END / STOP

13 Data Types Unsigned / Signed Interger types
short int int long int char Real / Floating Point types float double long double

14 Variable Naming Scheme
See Page138 in Manual. (Very, very, very important)

15 Variable Declaration Data-type variable-name //comment
int score;//holds student score double rate;//holds interest rate char opselect;//holds control character

16 Pseudocode DECLARE AS INTEGER score DECLARE AS DOUBLE rate
DECLARE AS CHAR opselect

17 Variable Initilization
Data-type variable-name = value//comment int score = 0;//holds student score double rate = 3.5;//holds interest rate char opselect = ‘x’;//holds control character Const int votingAge = 18;//legal voting age

18 Pseudocode DECLARE AS INTEGER score, SET AS 0
DECLARE AS DOUBLE rate, SET AS 0.0 DECLARE AS CHAR opselect, SET AS ‘x’

19 Output PRINT “Hello World!!” Display “Hello World!!”
cout<<“Hello World!!”; cout<<“Hello World!!”<<endl; Hello World!!

20 PRINT “I am ” age “ years old.”
cout<<“I am ”<<age<<“ years old.”<<endl; I am 5 years old.

21 Input READ num1 READ num1, num2 cin>>num1;
cin>>num1>>num2;

22 Escape Characters See page 129.

23 Arithmetic Addition(+); Subtraction(-); Multiplication(*);
Division(/); Modulus(%).

24 receiving-variable = variable operator variable
CALCULATE x = y + z x = y + z;

25 Incrementing INCREMENT count count++; count=count+1; count+=1;

26 Decrementing DECREMENT count count = count -1; count--; count -= 1;

27 Break

28 Selection

29 Structures If-else switch One way selection Liner nested
Non linear nested switch

30 If-else if (condition) { statements; } else

31 Pseudocode IF condition THEN statements ELSE ENDIF

32 One Way Selection if (condition) { statements; }

33 Pseudocode IF condition THEN statements ENDIF

34 Linear Nested if (condition) { statements; } else if else

35 Pseudocode IF condition THEN statements ELSE IF condition THEN ELSE
ENDIF

36 None Linear Nested if (condition) { statements; }

37 Pseudocode IF condition THEN statements ENDIF

38 Switch switch (condition) { case val1: statements; case val2: default:
}

39 Pseudocode SWITCH expression ENDSWITCH condition 1 : sequence 1
default: sequence ENDSWITCH

40 Break

41 Repetition

42 Structures while do…while for

43 While while (condition) { statements; }

44 Psudeocode WHILE condition statements ENDWHILE


Download ppt "Information Technology for Engineers"

Similar presentations


Ads by Google