Tutorial -1

Tutorial -1 - Intro to Comp Eng ECSE 221 Julien Cassis

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Intro to Comp Eng – ECSE 221 Julien Cassis Julien.cassis@mail.mcgill.ca Monday: 11:35 – 1:25 TR-2110 Wednesday: 3:35 – 5:25 TR-2100
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
General Structure Libraries (includes) Declarations Method definition Main method
Background image of page 2
4 basic data types Int: Integer Char: one byte character Float: single-precision floating point Double: double-precision floating point Arrays: int array[number][number]
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Example 1 //libraries #include <stdio.h> #include <stdlib.h> #include <string.h> Void main(){ Printf(“hello world”); }
Background image of page 4
Example 2 //libraries #include <stdio.h> #include <stdlib.h> #include <string.h> //declaration #define PI 3.14 float getRadius(){ float radius; printf(“Please enter the radius of the circle:\n”); scanf(“%f”,&radius); return(radius); }
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
float getArea(float radius){ float area; area = PI*radius*radius; return (area); } void main() { float circleradius = getRadius(); float localarea = getArea(circleradius); printf("the area of a circle of radius %f is: %f",circleradius,localarea); }
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/21/2008 for the course ESCE 221 taught by Professor Ferrie during the Spring '08 term at McGill.

Page1 / 15

Tutorial -1 - Intro to Comp Eng ECSE 221 Julien Cassis

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online