CSCI-1411 F UNDAMENTALS O F C OMPUTING L AB Shane Transue Summer 2014 1.

Slides:



Advertisements
Similar presentations
Chapter 3. Expressions and Interactivity CSC125 Introduction to C++
Advertisements

CS1010 Programming Methodology
CPS120: Introduction to Computer Science INPUT/OUTPUT.
CSCI-1411 F UNDAMENTALS O F C OMPUTING L AB Shane Transue Summer
1 Lecture 6 Chapter 3 Numeric Types, Expressions, and Output Dale/Weems/Headington.
1 Key Concepts:  Why C?  Life Cycle Of a C program,  What is a computer program?  A program statement?  Basic parts of a C program,  Printf() function?
 2002 Prentice Hall. All rights reserved. 1 Intro: Java/Python Differences JavaPython Compiled: javac MyClass.java java MyClass Interpreted: python MyProgram.py.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
An Introduction to Programming with C++ Fifth Edition Chapter 4 Chapter 4: Variables, Constants, and Arithmetic Operators.
1 Chapter 3 Topics Constants of Type int and float l Evaluating Arithmetic Expressions l Implicit Type Coercion and Explicit Type Conversion l Calling.
An Introduction to Programming with C++ Fifth Edition Chapter 4 Chapter 4: Variables, Constants, and Arithmetic Operators.
C++ Numerical Data Input/Output Programming. COMP 102 Prog Fundamentals I:C++ Numerical Data, Input/Output /Slide 2 Rules for Division l C++ treats integers.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to Python Programming Outline 2.1 Introduction 2.2 First Program in Python: Printing.
1 Lecture 7 Chapter 3 Numeric Types, Expressions, and Output Dale/Weems/Headington.
The printf Method The printf method is another way to format output. It is based on the printf function of the C language. System.out.printf(,,,..., );
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
Input and Output in Console Mode UNIVERSITY OF THE PUNJAB (GUJRANWALA CAMPUS) ADNAN BABAR MT14028 CR
Expressions and Interactivity Chapter 3. 2 The cin Object Standard input object Like cout, requires iostream file Used to read input from keyboard Often.
CSI 2372: Advanced Programming Concepts with C++
Chapter 3 COMPLETING THE BASICS Programming Fundamentals with C++1.
1 Chapter 3 Numeric Types, Expressions, and Output Dale/Weems.
© Copyright 2013 by Pearson Education, Inc. All Rights Reserved.1 Chapter 4 Mathematical Functions, Characters, and Strings.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
1 Last of the basics Controlling output Overflow and underflow Standard function libraries Potential pitfalls of getting information with cin Type casting.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
CH2 – Using Data. Constant Something which cannot be changed Data Type Format and size of a data item Intrinsic Data Types Pg. 47 – Table 2-1 Basic ones.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 5 – Dental Payment Application: Introducing.
Computer Programming TCP1224 Chapter 4 Variables, Constants, and Arithmetic Operators.
CSCI-1411 F UNDAMENTALS O F C OMPUTING L AB Shane Transue Spring 2014.
C++ Programming: Basic Elements of C++.
Introduction to C Programming Chapter 2 : Data Input, Processing and Output.
Introduction to C++ Version 1.1. Topics C++ Structure Primitive Data Types I/O Casting Strings Control Flow.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 3 Formatting Output.
I/O and Data Formatting Introduction to Class Concepts INFSY 307 Spring 2003 Lecture 3.
Chapter 3 Arithmetic Expressions, Function Calls, and Output
Input/Output Sujana Jyothi C++ Workshop Day 2. C++ I/O Basics 2 I/O - Input/Output is one of the first aspects of programming that needs to be mastered:
C++ Lecture 1 Friday, 4 July History of C++ l Built on top of C l C was developed in early 70s from B and BCPL l Object oriented programming paradigm.
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
CPS120: Introduction to Computer Science Formatted I/O.
A first program 1. #include 2. using namespace std; 3. int main() { 4. cout
CHAPTER 2 PART #3 C++ INPUT / OUTPUT 1 st Semester 1436 King Saud University College of Applied studies and Community Service CSC1101 By: Fatimah Alakeel.
A Simple Java Program //This program prints Welcome to Java! public class Welcome { public static void main(String[] args) { public static void main(String[]
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 3 – Inventory Application: Introducing Variables,
Operating System Using setw and setprecision functions Using setiosflags function Using cin function Programming 1 DCT
PROGRAM ESSENTIALS. TOKENS  SMALLEST UNITS OF A PROGRAM LANGUAGE  Special Symbols  Mathematical Operators  Punctuation  Word Symbols  Key Words.
Programming Fundamentals with C++1 Chapter 3 COMPLETING THE BASICS.
C++ REVIEW INPUT/OUTPUT (I/O). BRIEF NOTE “CLASSES” AND “STRUCTS” AND “TYPES” They are ADTs… They define data and operations on that data The ADTs in.
1 Manipulators manipulators are used only in input and output statements endl, fixed, showpoint, setw, and setprecision are manipulators that can be used.
Top-Down Stepwise Refinement (L11) * Top-Down Stepwise Refinement * Cast Operator * Promotion (Implicit Conversion) * Unary Operator * Multiplicative Operator.
CSCI-1411 F UNDAMENTALS O F C OMPUTING L AB Shane Transue Summer
CSCI-1411 F UNDAMENTALS O F C OMPUTING L AB Shane Transue Spring 2014.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Library Functions. CSCE 1062 Outline  cmath class library functions {section 3.2}  iomanip class library functions {section 8.5}  string class library.
1 Chapter 3 Numeric Types, Expressions, and Output Dale/Weems/Headington.
Chapter 4 Strings and Screen I/O. Objectives Define strings and literals. Explain classes and objects. Use the string class to store strings. Perform.
CSCI 125 & 161 / ENGR 144 Lecture 6 Martin van Bommel.
Objectives You should be able to describe: Interactive Keyboard Input
CPS120: Introduction to Computer Science
CPS120: Introduction to Computer Science
CSCI-1411 Fundamentals of Computing Lab
Chapter 2 part #3 C++ Input / Output
Basic Input and Output C++ programs can read and write information using streams A simple input stream accepts typed data from a keyboard A simple output.
Chapter 3 Input output.
Chapter 3: Expressions and Interactivity
An Introduction to Programming with C++ Fifth Edition
Chapter 2 part #3 C++ Input / Output
C++ Programming Basics
Unit 3: Variables in Java
Input / output (i/o) Acknowledgement: THE Slides are Prepared FROM SLIDES PROVIDED By NANCY M. AMATO AND Jory Denny.
Introduction to Python
Presentation transcript:

CSCI-1411 F UNDAMENTALS O F C OMPUTING L AB Shane Transue Summer

Lab 3: Expressions, Input, Output and Data Type Conversions 2  Overview:  Lab 3 Components Lab Sections (3.1, 3.2, 3.3, 3.4, 3.5, Design Document)  Lab 3 Concepts User Input Terminal (output) Formatting  C++ Standard Library Reference Utilize the search feature (ex. search for any standard function name)  Complete each Exercise Turn in your source code after all changes have been made Answer the questions from the exercises in a comment block

Lab 3: Expressions, Input, Output and Data Type Conversions 3  C++ Simple User Input  Utilizes the built in cin stream with the >> (extraction) operator  Example: float myValue; cin >> myValue; // use myValue...  Can be utilized with several data-types: int, double, float Strings are slightly different: Will only parse or accept the first word or ‘token’ the user provides: string name; cin >> name; At the terminal: What is your name? Bob Watson Value of name = Bob

Lab 3: Expressions, Input, Output and Data Type Conversions 4  C++ Terminal Output formatting  Obviously spaces and tab characters can be utilized ( “ “, “\t”) Tabs are not reliable (is a tab a character? 2 spaces, 4 spaces, 8 spaces?) Inserting spaces becomes incredibly tedious  setprecision(int n) Number of decimal places to display  setw(int n)  fixed “Floating-point values are written using fixed-point notation: the value is represented with exactly as many digits in the decimal part as specified by the precision field” (see setprecision )  showpoint Utilized with setprecision(n): noshowpoint: 30 showpoint:

Lab 3: Expressions, Input, Output and Data Type Conversions  3.1Working with the cin Statement  (bill.cpp)  3.2 Formatting Output  (tabledata.cpp)  3.3 Arithmetic Operations and Math Functions  (righttrig.cpp)  3.4 Working with Type Casting  (batavg.cpp)  3.5 Develop a Program  Choose 1of the 3 options  Name the source file: main.cpp  Include a design document for the option you choose Includes algorithm description, input, output, diagrams, formulas, etc. 5

Lab 3: Expressions, Input, Output and Data Type Conversions 6  Submission File Checklist  Submit all files on Canvas (One at a time or all of them in a single zip file). Be sure to include all source files and documents.  3.1 bill.cpp  3.2 tabledata.cpp  3.3 righttrig.cpp  3.4 batavg.cpp  3.5 main.cpp (For any option you choose)  3.5 Design Document

Lab 3: Customizing VIM 7  Vi/Vim contains several more features than nano:  Line numbers  Syntax Highlighting  Powerful Shortcuts  Vim can be customized to display all of these by default  Utilizing a shell script we can save these settings 1. Download the changevim.sh 2. Copy the file changevim.sh to your home directory: transues/changevim.sh 3. Run the script using: sh changevim.sh