Research Topics in Computational Science. Agenda Survey Overview.

Slides:



Advertisements
Similar presentations
Why not just use Arrays? Java ArrayLists.
Advertisements

AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Etter/Ingber Arrays and Matrices. Etter/Ingber One-Dimensional Arrays 4 An array is an indexed data structure 4 All variables stored in an array are of.
TE Sessions Supported by: Basic Concepts of Programming November 3, 2012.
Java POWERED BY: ARVIND DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING RADHA GOVIND GROUP OF INSTITUTIONS,MEERUT.
Chapter 10 Introduction to Arrays
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
C# Console Application
CS 106 Introduction to Computer Science I 02 / 18 / 2008 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 02 / 12 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 02 / 11 / 2008 Instructor: Michael Eckmann.
Loops – While, Do, For Repetition Statements Introduction to Arrays
© The McGraw-Hill Companies, 2006 Chapter 5 Arrays.
CS 106 Introduction to Computer Science I 10 / 04 / 2006 Instructor: Michael Eckmann.
ECE122 L11: For loops and Arrays March 8, 2007 ECE 122 Engineering Problem Solving with Java Lecture 11 For Loops and Arrays.
Chapter Eight: Arrays 1.Terms and what they mean 2.Types of arrays -One Dimensional arrays -Two Dimensional arrays -ragged arrays -Parallel arrays 3. Methods.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
PHYS 2020 Making Choices; Arrays. Arrays  An array is very much like a matrix.  In the C language, an array is a collection of variables, all of the.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 6 Repetition Statements.
© 2004 Pearson Addison-Wesley. All rights reserved5-1 Iterations/ Loops The while Statement Other Repetition Statements.
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
CS 106 Introduction to Computer Science I 09 / 28 / 2007 Instructor: Michael Eckmann.
The switch Statement, DecimalFormat, and Introduction to Looping
TODAY’S LECTURE Review Chapter 2 Go over exercises.
COMPUTER PROGRAMMING II SUMMER 2011 Visual Basic to C#
Games and Simulations O-O Programming in Java The Walker School
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
What is an Array? An array is a collection of variables. Arrays have three important properties: –group of related items(for example, temperature for.
Arrays An array is a data structure that consists of an ordered collection of similar items (where “similar items” means items of the same type.) An array.
Semester Review. As we have discussed, Friday we will have in class time for you to work on a program, this program will come with instructions and you.
1 CS428 Web Engineering Lecture 20 Control Structures, Loops and Pointers File Uploading Function (PHP - III)
Visual Basic Programming Chapter Six Notes Repetition and the Do Statement ADDING ICONS TO YOUR FORM –It is possible to add an ______________ to your title.
M180: Data Structures & Algorithms in Java Arrays in Java Arab Open University 1.
Current Assignments Homework 2 is available and is due in three days (June 19th). Project 1 due in 6 days (June 23 rd ) Write a binomial root solver using.
CHAPTER 7 arrays I NTRODUCTION T O C OMPUTER P ROGRAMMING (CSC425)
Week 3 - Wednesday.  What did we talk about last time?  Other C features  sizeof, const  ASCII table  printf() format strings  Bitwise operations.
COMPUTER PROGRAMMING II SUMMER 2011 Visual Basic to C#
Advanced Computer Science Lesson 4: Reviewing Loops and Arrays Reading User Input.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 13 Conditional.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Conditionals Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignment? zPass by value limitations.
Structuring Data: Arrays ANSI-C. Representing multiple homogenous data Problem: Input: Desired output:
How do you do the following? Find the number of scores within 3 points of the average of 10 scores? What kind of a tool do you need? Today’s notes: Include.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Pointers in C++. Topics Covered  Introduction to Pointers  Pointers and arrays  Character Pointers, Arrays and Strings  Examples.
Controlling Program Flow with Looping Structures
A Balanced Introduction to Computer Science, 3/E David Reed, Creighton University ©2011 Pearson Prentice Hall ISBN Chapter 13 Conditional.
COMPUTER PROGRAMMING 2 ArrayLists. Objective/Essential Standard Essential Standard 3.00Apply Advanced Properties of Arrays Essential Indicator 3.02 Apply.
Week 10 - Wednesday.  What did we talk about last time?  Method example  Roulette simulation  Types in Java.
int [] scores = new int [10];
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 5 Looping.
Computer Science I Animations. Bouncing ball. The if statement. Classwork/homework: bouncing something. Compress and upload work to Moodle.
LOOPS CHAPTER Topics  Four Types of Loops –while –do…while –for –foreach  Jump Statements in Loops –break –continue 2.
Week 3 - Friday.  What did we talk about last time?  Preprocessor directives  Other C features  sizeof, const  ASCII table  printf() format strings.
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
Chapter 6 Controlling Program Flow with Looping Structures.
LESSON 8: INTRODUCTION TO ARRAYS. Lesson 8: Introduction To Arrays Objectives: Write programs that handle collections of similar items. Declare array.
Lecture 6 Repetition Richard Gesick.
Chapter 4 LOOPS © Bobby Hoggard, Department of Computer Science, East Carolina University / These slides may not be used or duplicated without permission.
Arrays, For loop While loop Do while loop
Looping and Repetition
Outline Altering flow of control Boolean expressions
Welcome back to Software Development!
Logical Operations In Matlab.
Code Refresher Test #1 Topics:
CHAPTER 21 LOOPS 1.
Presentation transcript:

Research Topics in Computational Science

Agenda Survey Overview

Notes on the Survey: End on Time – I will try to end 10 min early for work & qus This isn’t too slow – Nobody said slow, but some said fast Upload Class Code – More time on my code (I will slow down) Go Quicker: with questions Go Slower: with in class coding

Today’s Agenda Code with notes – practice for homework set Download the PPT to follow along with while coding

Indexing And Arrays In C we start counting at 0 The “1 st” value is actually the “0 th ” value in C

Array Indecies double x = {0.0, 3.14, …, 1.1, 2.7} 0.0 x[0] 3.14 x[1] …1.1 x[n-2] 2.7 x[n-1] The computer needs to set aside memory, then the values can be placed in memory. For an array of n elements we start at element 0 and access up to element n-1.

Arrays An array is a data object of a fixed size to hold many variables of the same type int[] a, b, c; // Will create 3 integer arrays This doesn’t allocate memory for the array a = new int[10]; Allocates memory for 10 ints in array a int[] a = {0,1}; //declare, allocate, assign values

Lists List – Creates an int list List – Creates a double list List – creates a list of strings List – creates a list of the type specified between <> We can create lists of any object We can have a list of buttons or images

List Functions x = myList[3]; – gets the value at index 3 from the list myList.Add(3.14); – Adds the value 3.14 to the list myList.Remove(3.14); – removes first occurance of 3.14 from the list myList.RemoveAt(3); – removes the item myList[3]

c++, c--, ++c, --c Only used for “int” c++ and ++c will add 1 to the variable c – c++ will use c, THEN add 1 – ++c will add 1 to c, then use it c-- and --c will subtract 1 from the variable c – c-- will use c, then subtract 1 – --c will subtract 1, then use c Example: c = 0; mbox(c++);//displays 0 mbox(c);// displays 1 mbox(++c);//displays 2

For Loop This will loop a specified number of times, AND increment a variable (usually i, j, or k) There is a standard loop that is used MOST of the time You can change as needed

For Code for (int i=0; i<5; i++) { mbox(“Hello” + name[i]); } This will say hello to the first five names in the array “name” Start at i=0 Continue while i<5 At the end of every loop do the operation i++

For Each Loop This will loop through each element of an array or list This can be very useful when we don’t know how many things are in our list/array

ForEach Code int cider = 0; foreach(int age in ages){ if(age<20) cider++; /* count the number of cider drinkers */ } We have to declare the type, here it is an int We have to give a temp name, age is a clear name for this We have to give the name of our array/list

While Loop While loops can run forever! – Becareful of infinite loops These will run while a statement is true

While Loop Example bool myval = 1; while( myVal < 100 ) { myVal = myVal * 2; } This will find the smallest power of 2 greater than 100. After each loop it checks the while

Do While Loop (aka do loop) This loop will ALWAYS execute one time At the end of the loop it checks to see if it should run again

Do While Loop myVal = 200; do { myVal *= 2; } while (myVal < 100); This does the same thing as the last loop. Even though 200 will give a false value for “while” it will still do the loop one time

Switch Control Select based on matching input This is good when you have a lot of cases to be tested for.

Switch Code switch( word ) { case “boy”: // do this break; case “girl”: // do this break; default: // do this break; } If the variable word is the same as “boy” it will do the first statement it will try every CASE until it finds one that matches or the end. Every case must have a break.