Language Issues Misunderstimated? Sublimable? Hopefuller?

Slides:



Advertisements
Similar presentations
Introduction to C++ An object-oriented language Unit - 01.
Advertisements

1 Lecture 16:User-Definded function I Introduction to Computer Science Spring 2006.
Write a program step by step. Step 1: Problem definition. Given the coordinate of two points in 2-D space, compute and print their straight distance.
Software Design Designer clothes?. Outline Announcements: –Homework I on web, due Wed., 5PM by –Starting Friday, Wed. and Fri. lectures will meet.
Chapter 7: User-Defined Functions II
1 11/05/07CS150 Introduction to Computer Science 1 Functions Chapter 6, page 303.
C++ data types. Structs vs. Classes C++ Classes.
CS 201 Functions Debzani Deb.
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
Templates. Objectives At the conclusion of this lesson, students should be able to Explain how function templates are used Correctly create a function.
Language Issues Misunderstimated? Sublimable? Hopefuller? "I know how hard it is for you to put food on your family.” "I know the human being and fish.
CMSC 104, Version 8/061L18Functions1.ppt Functions, Part 1 of 4 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function.
Functions in C. Function Terminology Identifier scope Function declaration, definition, and use Parameters and arguments Parameter order, number, and.
 Introduction Introduction  Types of Function Types of Function  Library function Library function  User defined function User defined function 
1 Project 5: Median. 2 The median of a collection of numbers is the member for which there are an equal number less than or equal and greater than or.
Outline Announcements: –Homework I on web, due Fri., 5PM by –Small error on homework –Wed and Fri in ACCEL, Attendance required –LAST DAY TO ADD/DROP!
Introduction to C Programming CE Lecture 7 Compiler options and makefiles.
Monday, Jan 13, 2003Kate Gregory with material from Deitel and Deitel Week 2 Questions from Last Week Control Structures Functions Lab 1.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition, Fifth Edition Chapter 7: User-Defined Functions II.
Software Design. Outline Announcements: –Homework I on web Friday –Starting Friday, Wed. and Fri. lectures will meet in ACCEL “Green” Room in Carpenter.
142 F -1 Functions chapter 3 of the text int main(void) { double x,y,z; … x = cube(y/3.0); … printf(“%f cubed is %f”,x,cube(x)); … return 0; } double cube(double.
Debugging. Outline Announcements: –HW II due Fridayl db.
#include using namespace std; // Declare a function. void check(int, double, double); int main() { check(1, 2.3, 4.56); check(7, 8.9, 10.11); } void check(int.
Functions: Part 2 of /11/10: Lecture 16 CMSC 104, Section 0101 John Y. Park 1.
Separate Compilation Bryce Boe 2013/10/09 CS24, Fall 2013.
FUNCTIONS. Midterm questions (1-10) review 1. Every line in a C program should end with a semicolon. 2. In C language lowercase letters are significant.
Dayu Zhang 9/10/2014 Lab03. Outline Brief Review of the 4 Steps in Hello.cpp Example Understand endl and \n Understand Comment Programming Exercise -
Outline Announcements: –HW I key online this afternoon –HW II due Friday –Sign up to discuss projects Debugging Testging for correctness.
1 COMS 261 Computer Science I Title: Classes Date: November 4, 2005 Lecture Number: 27.
1 Project 5: Leap Years. 222 Leap Years Write a program that reads an integer value from the user representing a year and determines if the year is a.
Building Programs from Existing Information Solutions for programs often can be developed from previously solved problems. Data requirements and solution.
Announcements. Practice questions, with and without solutions will be uploaded by Friday 5 th November, make sure to check them before the weekend \\netstorage\Subjects\ITCA-b\Exam.
1 Project 12: Cars from File. This is an extension of Project 11, Car Class You may use the posted solution for Project 11 as a starting point for this.
ECE 382 Lesson 20 Lesson Outline Structs Functions Headers Example
Functions + Overloading + Scope
User-Written Functions
Chapter 6: User-Defined Functions I
Chapter 7: User-Defined Functions II
APPENDIX a WRITING SUBROUTINES IN C
Objectives In this chapter, you will:
ECE 264 Object-Oriented Software Development
EECs 183 Discussion 10 Hannah Westra.
C Basics.
Programmazione I a.a. 2017/2018.
Data Structures Recursion CIS265/506: Chapter 06 - Recursion.
User-Defined Functions
MATLAB DENC 2533 ECADD LAB 9.
Object-Oriented Programming (OOP) Lecture No. 32
2011/11/10: Lecture 21 CMSC 104, Section 4 Richard Chang
Outline Announcements Dynamic Libraries HWII on web, due Friday
6.12 Default Arguments.
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Funamental slides
Functions, Part 2 of 3 Topics Functions That Return a Value
Reference Parameters.
Functions with arrays.
Standard Input/Output Stream
Topics discussed in this section:
EECE.2160 ECE Application Programming
Functions continued.
IPC144 Introduction to Programming Using C Week 4 – Lesson 2
Outline Announcements Differences between FORTRAN and C
ENERGY 211 / CME 211 Lecture 8 October 8, 2008.
C++ data types.
Functions, Part 2 of 3 Topics Functions That Return a Value
C# Language & .NET Platform 10th Lecture
Functions, Part 2 of 3 Topics Functions That Return a Value
ME 123 Computer Applications I Lecture 4: Vectors and Matrices 3/14/03
ME 123 Computer Applications I Lecture 5: Input and Output 3/17/03
Presentation transcript:

Language Issues Misunderstimated? Sublimable? Hopefuller? "I know how hard it is for you to put food on your family.” "I know the human being and fish can coexist peacefully."

Outline Announcements: HW1 due Friday Developing RAD1D Lab

Designing RAD1 Get C0, u, k, dt,t, T, m, L (dx=L/(m-1)) from user Build matrix A using k, dt, dx Build RHS vector f using u, k, and reaction data Solve A*C=b for C t=t+dt If(t<T) Copy C=C0 Change u and k if needed Repeat 2-6 Else d) Output C and quit

Getting Info From User Need several parameter values & a file name Options: Query user? Values in a file & pass file name? Cbasic basic.cmnd I like option 3

Command File m--number of grid points L--length of the domain dt--time step T--end time

Designing Cbasics Get name of command file (user or command line) Read command file and get m, L, dt, T Create a length m array C Fill array with location of grid points Save C to C.txt

Structure of Cbasics Main.c--main program Io.c--functions for input/output ReadComm ReportParams PrintArray System.c--functions for array allocation & error reporting Error newarray_double

Prototypes & Header files C subroutines must declare the types of their inputs and outputs using “prototypes” double sin(double angle_in_radians); void PrintArray(char name[], double C[], int m); Prototypes allow the compiler to check that you are calling a routine in the correct way Suppose subroutine X is implemented in file X.c. In order to call X from another file (Y.c), Y needs to see the prototype for X. Solution--create a header file with the prototype X.c--implements X X.h--prototype for X Both X.c and Y.c must include X.h: #include “X.h” must appear before any call to X or its implementation