X Tours Coordinator: Prof. Yves Lansac Université François Rabelais, Tours, Loire Vallée, France.

Slides:



Advertisements
Similar presentations
Technotronics GCECT '091 Decode C This is a C Programming event, where you will be given problems to solve using C only. You will be given a Linux system.
Advertisements

Compilation and Debugging 101. Compilation in C/C++ hello.c Preprocessor Compiler stdio.h tmpXQ.i (C code) hello.o (object file)
Chapter 12 Separate Compilation and Namespaces. Abstract Data Type (ADT) ADT: A data type consisting of data and their behavior. The abstraction is that.
C Module System C and Data Structures Baojian Hua
Case studies over control structures and iterative structures Instructor – Gokcen Cilingir Cpt S 121 (July 6, 2011) Washington State University.
1 Lab Session-1 CSIT221 Fall 2002 b Refresher slides b Practice Problem b Lab Exercise (Demo Required)
Chapter 7 - Functions. Functions u Code group that performs single task u Specification refers to what goes into and out of function u Design refers to.
C Module System C and Data Structures Baojian Hua
Writing and Testing Programs Drivers and Stubs Supplement to text.
1 Lab Session-XII CSIT121 Fall 2000 b Namespaces b Will This Program Compile ? b Master of Deceit b Lab Exercise 12-A b First Taste of Classes b Lab Exercise.
1 Lab Session-XIV CSIT121 Spring 2002 b Namespaces b First Class Travel b Lab Exercise 14 (Demo) b Lab Exercise b Practice Problem.
Chapter 6: User-Defined Functions I
CS201 – C Functions Procedural Abstraction Code Reuse C Library.
CS 261 – Data Structures C – Compilation Process.
Introduction to C. A Brief History Created by Dennis Ritchie at AT&T Labs in 1972 Originally created to design and support the Unix operating system.
Computer Science 210 Computer Organization Introduction to C.
Functions Lecture 4 – Section 2: 9/21/05 Section 4: 9/22/05.
Introduction to C Programming. A Brief History u Created by Dennis Ritchie at AT&T Labs in 1972 u Originally created to design and support the Unix operating.
Chapter 6: User-Defined Functions I Instructor: Mohammad Mojaddam
CS 627 Project RSA Encryption/Decryption supporting Big Integer Arithmetic …Sagar Chivate.
Multiple Files. Monolithic vs Modular  one file before  system includes  main driver function  prototypes  function.
Week 2 - Friday.  What did we talk about last time?  Base systems  C literals  Representations in memory.
CMSC 1041 Functions II Functions that return a value.
UNIT 13 Separate Compilation.
Functions CIS Feb-06. Summary Slide Using Functions Mathematical Functions Misc. Functions Naming Conventions Writing Functions –Function Prototype.
Compilation & Linking Computer Organization I 1 November 2009 © McQuain, Feng & Ribbens The Preprocessor When a C compiler is invoked, the.
L function n predefined, programmer-defined l arguments, (formal) parameters l return value l function call, function invocation l function definition.
Lexical Elements, Operators, and the C Cystem. C overview recap functions –structured programming –return value is typed –arguments(parameters) pointers.
CGS 3460 Preprocessor n All preprocessor directives or commands begin with a #. lE.g. #include C program → Modified C program → Object Code n Can appear.
Exam / Homework Exam 1 Starting K&R chapter 4 tonight
Math Library Functions
1 Lab 1. C Introduction  C: –Developed by Bell lab. in –a procedure-oriented programming language.  Developing environments: –Editing –Preprocessing.
CS 261 – Recitation 2 Fall 2013 Oregon State University School of Electrical Engineering and Computer Science.
Lecture 05 Functions II, Storage Class, Scope, rand() METU Dept. of Computer Eng. Summer 2002 Ceng230 - Section 01 Introduction To C Programming by Ahmet.
Khalid Rasheed Shaikh Computer Programming Theory 1.
C Programming Separate Compilation Variable Lifetime and Scope make.
15. WRITING LARGE PROGRAMS. Source Files A program may be divided into any number of source files. Source files have the extension.c by convention. Source.
SubPrograms Top-Down Design using stepwise refinement leads to division of tasks.
Object-Oriented Paradigm The Concept  Bundled together in one object  Data Types  Functionality  Encapsulation.
Separate Compilation Bryce Boe 2013/10/09 CS24, Fall 2013.
1 Steps to use Flex Ravi Chotrani New York University Reviewed By Prof. Mohamed Zahran.
Program in Multiple Files. l all C++ statements are divided into executable and non-executable l executable - some corresponding machine code is generated.
Special Methods in Java. Mathematical methods The Math library is extensive, has many methods that you can call to aid you in your programming. Math.pow(double.
Chapter 7 - Functions. Functions u Code group that performs single task u Specification refers to what goes into and out of function u Design refers to.
CDS 301 Spring, 2013 CH3: MATLAB OpenGL Samples February 28, 2013 Jie Zhang Copyright ©
L131 Assignment Operators Topics Increment and Decrement Operators Assignment Operators Debugging Tips rand( ) math library functions Reading Sections.
Automating Builds with Makefiles
What Is? function predefined, programmer-defined
Computer Science 210 Computer Organization
Separate Compilation and Namespaces
Chapter 13 - The Preprocessor
Random Numbers Until now, all programs have behaved deterministically - completely predictable and repeatable based on input values Some applications.
Functions Separate Compilation
Programmer-Defined Functions, Call-by-Value, Multiple Files Lab 5
CS1010 Programming Methodology
The Preprocessor Based on Chapter 1 in C++ for Java Programmers by Weiss When a C compiler is invoked, the first thing that happens is that the code is.
CS1010 Programming Methodology
Operating System Discussion Section.
Computer Science 210 Computer Organization
Lexical Elements, Operators, and the C Cystem
Lexical Elements, Operators, and the C Cystem
Miscellaneous functions
Comments, Prototypes, Headers & Multiple Source Files
C++ Compilation Model C++ is a compiled language
Hacettepe University Computer Engineering Department
Lab 4: Introduction to Scripting
What Is? function predefined, programmer-defined
Chapter 11 Class Inheritance
Review Lab assignments Homework #3
Preprocessor Directives and Macros Chapter 21
Presentation transcript:

x Tours Coordinator: Prof. Yves Lansac Université François Rabelais, Tours, Loire Vallée, France

Lab 0. Warm-up for Calculation of 

- Call “ran3.h” (prototype or definition of function). - Call “ran3.c” (implementation of function). - See “architecture.pdf” for the architecture. - Input how many sets of (x i, y i ) to generate. - Input a seed for random number generator. (a random-looking big number < 10 9 ) - To compile: 1)Create an object file from each C source file: gcc -c xxx.c gcc -c ran3.c 2) Link them together with the math library to produce an executable (called xxx): gcc -o xxx xxx.o ran3.o -lm 6. Print a set of random numbers (x i, y i ) using a random number generating function ran3.c. #include #include  ran3.h  /* function main */ main() { long seed; // random number generator seed double x;... /* generate a random number x in [0,1] */ x = ran3(&seed); y = ran3(&seed);... } double ran3(long *idum) {... } #ifndef RAN3_H #define RAN3_H double ran3(long *idum); #endif [xxx.c] [ran3.c] [ran3.h] implementation main prototype function calls