BIL104E_w5 - BIL104E INTRODUCTION TO SCIENTIFIC AND...

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

View Full Document Right Arrow Icon
BIL104E INTRODUCTION TO SCIENTIFIC AND ENGINEERING COMPUTING (C) WEEK – 5
Background image of page 1

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

View Full DocumentRight Arrow Icon
FUNCTIONS #include <stdio.h> Function_prototype Main function { Function_call } Function definition
Background image of page 2
Function Prototype double fonksiyon1(double x, int y); int fonksiyon2(double x, int y); void fonksiyon3(double x, double y);
Background image of page 3

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

View Full DocumentRight Arrow Icon
Function Definition int fonksiyonum(int x, double y) { x = 1+2; y = 1.0 + 2.0; }
Background image of page 4
Random Number Generator rand function Load <stdlib.h> Returns "random" number between 0 and RAND_MAX (at least 32767 ) number = rand(); Scaling To get a random number between 1 and n ( rand() % n ) rand() % n returns a number between 0 and n 1 ( rand() % 6 ) between 0 - 5 Add 1 to make random number between 1 and n 1 + ( rand() % n) ( rand() % 6)+1 between 1 6 Randomizing to get different value with rand function use load <time.h> srand (time(NULL));
Background image of page 5

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

View Full DocumentRight Arrow Icon
Application-I Write a rolling dice program Choose number of dice face (standart 6)
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 11/22/2010 for the course BIL 104 taught by Professor Abc during the Fall '09 term at Istanbul Technical University.

Page1 / 11

BIL104E_w5 - BIL104E INTRODUCTION TO SCIENTIFIC AND...

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