Free Essay

Input and Output Stream

In:

Submitted By nimal9042
Words 256
Pages 2
Tutorial 2: Exercise on Input and Output Stream 1. Write a C++ program to display the following output on the screen using multiple cout statements.

2. Write a C++ program to display the following output using only one cout statement.

3. Write the output of the following program.

#include <iostream> using namespace std;

int main ()
{
int number1 = 45; float number2 = 75.25; cout<<"The Value of number1 = "<<number1; cout<<" The Value of number2 = "<<number2;
}

4. Write the output of the following program.
#include <iostream> using namespace std;

int main ()
{
int number1 = 45; float number2 = 75.25; cout<<"The Value of number1 = "<<number1<<" The Value of number2 = "<<number2;
}

5. Write a C++ program to input two integer numbers from the keyboard. Extract the two integer numbers by using two separate cin statements and display the numbers on the screen.

6. Modify the above program to extract the two integer numbers by using only one cin statement and display the numbers of the screen.

7. Write a C++ program that accepts your first name and the second name and display the full name on the screen.

8. Write a C++ program that accepts the following line and text and display the line on the screen.
“This is my second tutorial class of CPT111”

9. Write a C++ program to accept 000015 from the keyboard and convert the string to an integer and display the integer on the screeInput

Similar Documents

Premium Essay

Nt1310 Unit 3 Assignment

...The localhost is the host-name of the client and the number 1342 is the port number. This post number must be the same port number at the server. BufferedReader inuser = new BufferedReader(new InputStreamReader(System.in)); - This line creates the input stream object inuser of type BufferedReader by invoking the standard input System.in. Therefore, the client can get the text from keyboard to the program. DataOutputStream outser = new DataOutputStream(c.getOutputStream()); - This line creates the output stream object outser of type DataOutputStream. This output stream is attacked to the socket c. After the client reads the text from the keyboard, it sends the that text to the server through the socket c. BufferedReader inser = new BufferedReader(new InputStreamReader(c.getInputStream())); - This line creates the input stream object inser of type BufferedReader. This input stream is attacked to the socket c. After receiving and modifying the text, the server resends the modified text to the client through the socket...

Words: 1181 - Pages: 5

Free Essay

Bt0064 Smu Bsc It - Digital Logic

...other functions, no matter how complex, can be derived. These functions are named and, or, and not. Each of these has a specific symbol and a clearly-defined behavior, as follows: | | The AND GateThe AND gate implements the AND function. With the gate shown to the left, both inputs must have logic 1 signals applied to them in order for the output to be a logic 1. With either input at logic 0, the output will be held to logic 0.If your browser supports the Javascript functions required for the demonstrations built into this page, you can click the buttons to the left of the AND gate drawing to change their assigned logic values, and the drawing will change to reflect the new input states. Other demonstrations on these pages will work the same way.There is no limit to the number of inputs that may be applied to an AND function, so there is no functional limit to the number of inputs an AND gate may have. However, for practical reasons, commercial AND gates are most commonly manufactured with 2, 3, or 4 inputs. A standard Integrated Circuit (IC) package contains 14 or 16 pins, for practical size and handling. A standard 14-pin package can contain four 2-input gates, three 3-input gates, or two 4-input gates, and still have room for two pins for power supply...

Words: 1845 - Pages: 8

Free Essay

C Language

...Understand Text and Binary Files  Declaring, Opening, and Closing File Streams  Reading from and Writing to Text Files  Passing and Returning Filenames  Reading from and Writing to Binary Files (Optional)  2 Files   File: collection of data that is stored together under a common name, usually on a disk, magnetic tape, or CD-ROM Each file has a unique filename, referred to as the file’s external name  For example, prices.dat and info.txt 3 Text and Binary Files  A file can be thought as an array of bytes. Characters Displayed 768A Code page: ASCII Code Software Interpretation Binary numbers, in decimal numbers: 55 54 56 65 4 ASCII Table 5 Other Code Page* How this text file is stored in computer? Hello 您好 Encode simplified Chinese • GB2312 • GB18030 • UTF-8 6 Declaring, Opening, and Closing File Streams  To store and retrieve data outside a C program, you need two items:   A file A file stream  File stream: one-way transmission path used to connect a file stored on a physical device to a program   Input file stream: receives data from a file into a program Output file stream: sends data to a file 7 File Streams 8 Declaring a File Stream    File stream is a data structure For each file that your program uses, a file stream must be named (declared) and created (opened) Declare a file stream  FILE *inFile;  Asterisk is necessary, inFile is a pointer pointing...

Words: 1171 - Pages: 5

Free Essay

Mmmmm

...Jaipur Engineering College & Research Centre, Jaipur Manual Of TCP/IP Programming Lab (7CP8) Session 2007-2008 Computer Engineering Department Prepared By: Mahesh Jangid cc Exercise No. 1 AIM: Study of Data Communication System, Connectionless and connection oriented service, programming with TCP and UDP. Theory: - [pic] Networking Basics • computers running on the Internet communicate to each other using either Transmission Control (TCP) or the User Datagram (UDP) protocol • when we write Java programs that communicate over the network, we are programming at the application layer • however, to decide which Java classes our programs should use, we need to understand how TCP and UDP differ UDP (User Datagram Protocol) • connectionless - sends independent packets of data, called datagram, from one computer to another with no guarantees about arrival • each time a datagram is sent, the local and receiving socket address need to be sent as well TCP (Transmission Control Protocol) • connection-oriented - provides a reliable flow of data between two computers _ data sent from one end of the connection gets to the other end in the same order • in order to communicate using TCP protocol, a connection must first be established between the pair of sockets • once two sockets have been connected, they can be used to transmit data in both (or either one of the) directions UDP vs. TCP: Which Protocol...

Words: 2326 - Pages: 10

Free Essay

Modflow

...= values of hydraulic conductivity along xyz axes (LT-1) h = total head (L) W = Sources and sinks (T-1) Ss = Specific storage (L-1) t = time (T) Finite Difference Model Model grid: • Rows, columns, layers • Count from the upper left corner Finite Difference Model Model grid: • Cell-Centered • Horizontal grid: rectangular cell varies with size Finite Difference Model Model grid: • Cell-Centered • Vertical layers: thickness varies MODFLOW Packages • Basic • Flow Package – BCF – LPF – HUF • River • Drain • Well • Recharge • Evapotranspiration • Changing Head Boundary • General Head Boundary • Horizontal Flow Barrier • Stream-Aquifer Interaction • Solvers • Output Control MODFLOW Basic Package (BAS) Functions: • Discretization of model domain; • Selection of major options and the designation of their input unit numbers; • Specifying initial and boundary conditions, and • Discretization of time. MODFLOW Basic Package (BAS) Definition of model grids and boundaries • Number of rows, columns and layers • Cells outside model domain are marked as inactive • Controlled through IBOUND array MODFLOW Basic Package (BAS) Definition of stress periods and time steps • Simulation...

Words: 1870 - Pages: 8

Free Essay

Assignment 1

...Concurrency in C+ + 1 Assignment 1 These questions requires the use of C+ which means compiling the program with the u++ command, including +, uC++.h as the first include file in each translation unit, and replacing routine main with member uMain::main . 1. Write a semi-coroutine with the following public interface (you may only add a public destructor and private members): _Coroutine FloatConstant { public: enum status { MORE, GOOD, BAD }; // possible status private: status stat; // current status of match char ch; // character passed by cocaller void main(); // coroutine main public: status next( char c ) { ch = c; // communication in resume(); // activate return stat; // communication out } }; which verifies a string of characters corresponds to a C+ floating-point constant described by: + floating-constant : signÓÔØ fractional-constant exponent-part ÓÔØ floating-suffixÓÔØ signÓÔØ digit-sequence exponent-part floating-suffixÓÔØ fractional-constant : digit-sequenceÓÔØ “.” digit-sequence digit-sequence “.” “e” “E” signÓÔØ digit-sequence exponent-part : sign : “+” “-” digit-sequence : digit digit-sequence digit floating-suffix : “f” “l” “F” “L” digit : “0” “1” “2” “3” “4” “5” “6” “7” “8” “9” (Where XÓÔØ means X ¯ and ¯ means empty.) In addition, there is a maximum of 16 digits for the mantissa (non-exponent digits) and 3 digits for the characteristic (exponent digits). For example, the following are valid C/C+ floating-point constants: + 123.456 -.099 +555. 2.7E+1 -3.555E-12 After creation...

Words: 1986 - Pages: 8

Free Essay

Embedded Systems Design

...Embedded Systems Design Scott DeCota Modern Operating Systems Embedded systems are all around us. They run the engine, brakes, seatbelt, airbag, and audio system in your car. They digitally encode your voice and construct a radio signal to send it from your cell phone to a base station. They control your microwave, dishwasher, and DVD player. They command robots on a factory floor, power generation in a plant, processes in a chemical plant, and the traffic lights in the city. Embedded operating systems are growing increasingly common in everyday appliances and other devices. These operating systems provide application interfaces for a wide range of different applications. The challenge for developers is to determine which operating system or programming language to use in a particular device or project, and how to utilize the parallelism and concurrency capabilities of the hardware and programming language chosen for a project to design a system of adequate timing precision and efficiency. Developers working with embedded systems need to be extremely diligent in regards to timing and optimization. Embedded systems are frequently interacting with the physical environment in which multiple sources of data may be interacting with the system simultaneously. Developers should have a solid understanding of the parallelism and concurrency capabilities of the hardware for a selected project. These features can occur in different forms that can greatly affect the timing of the...

Words: 995 - Pages: 4

Premium Essay

Nt1310 Unit 4

...1. Describe the process by which software recognizes keystrokes. Keystrokes are translated into electrical signals by the modern keyboard. They use an integrate microprocessor to generate bit-stream outputs. Pressing a key sends a coded signal to the controller, and the controller generates a bit-stream output according to an internal program or lookup table. 2. What is a font? What is point size? A font is a collection of characters of similar style and appearance. Point size refers to characters’ height not with. 3. What are the additive colors? What are the subtractive colors? What types of I/O devices use each kind of color? Additive colors are the primary colors for video display (red, green, blue). Subtractive colors are cyan (absence of red), magenta (absence of green), and yellow (absences of blue) it is often referred to by the abbreviation CMY. A monitor is an I/O device that uses additive colors. A printer is an I/O device that uses subtractive colors. 4. What is a bitmap? How does a bitmap’s chromatic resolution affect its size? A bitmap is a stored set of numbers describing the content of all pixels in an image. A monochrome display displays one of two colors and requires only one bit per pixel. A grayscale display displays black, white and shades of...

Words: 1008 - Pages: 5

Free Essay

Functional Application and Minimization of Booleanfunction Using Gates, K-Map & Quine-Mccluskey

...Vol 3 Issue 2 March 2013 Impact Factor : 0.2105 ORIGINAL ARTICLE ISSN No : 2230-7850 Monthly Multidisciplinary Research Journal Indian Streams Research Journal Executive Editor Ashok Yakkaldevi Editor-in-chief H.N.Jagtap IMPACT FACTOR : 0.2105 Welcome to ISRJ RNI MAHMUL/2011/38595 ISSN No.2230-7850 Indian Streams Research Journal is a multidisciplinary research journal, published monthly in English, Hindi & Marathi Language. All research papers submitted to the journal will be double - blind peer reviewed referred by members of the editorial Board readers will include investigator in universities, research institutes government and industry with research interest in the general subjects. International Advisory Board Flávio de São Pedro Filho Federal University of Rondonia, Brazil Hasan Baktir Mohammad Hailat English Language and Literature Dept. of Mathmatical Sciences, University of South Carolina Aiken, Aiken SC Department, Kayseri Kamani Perera 29801 Regional Centre For Strategic Studies, Sri Ghayoor Abbas Chotana Lanka Department of Chemistry, Lahore Abdullah Sabbagh University of Management Sciences [ PK Engineering Studies, Sydney Janaki Sinnasamy ] Librarian, University of Malaya [ Anna Maria Constantinovici Catalina Neculai Malaysia ] AL. I. Cuza University, Romania University of Coventry, UK Romona Mihaila Spiru Haret University, Romania Delia Serbescu Spiru Haret University, Bucharest, Romania Anurag Misra DBS College, Kanpur Titus Pop Ecaterina...

Words: 7048 - Pages: 29

Free Essay

Voice Chat System

...Voice Chat & Video Conferencing INDEX Title of Project……………………………………………………. i Certificate………………………………………………………… ii Acknowledgements……………………………………………… iii 1 Introduction 2 Design & Implementation 2.1 Why Java Platform 2.2 Java Media Framework Streaming Media Architecture Presentation Processing Capture Media Data Storage & Transmission 2.3 Real-time Transport Protocol Streaming Media RTP Architecture RTP Application 2.4 JMF RTP Application Programming Interface RTP API Architecture Reception Transmission 2.5 Requirements & Specification Feasibility Analysis Requirements Functionality Specification 2.6 Diagrams 3 Results 3.1 Snapshots 3.2 Future Offshoots 3.3 Conclusion References CHAPTER 1 INTRODUCTION Introduction To sum up, the at most priority must be given to the definition of the problem statement of the project to be undertaken. So the project is a set of file related with each other developed by the creators of the system to accomplish a specific purpose. Our purpose is to design project for “VOICE CHATTING & VIDEO CONFERENCING”. As the name suggests, our project is based on audio/video transmission & reception. Through our application two or more persons in an intranet can Chat with one another & they can have Video Conferencing...

Words: 5465 - Pages: 22

Premium Essay

Factors Affecting Academic Performance of Working Students

...to those who are financially distressed to pursue and finish a college degree in order to competitive in the future and be able to realize their goals and aspirations. It may also provide learning experiences and information to other students who are not working. In order to accomplish our objectives, we adopted several methodologies in obtaining data and information such as conducting surveys by providing questionnaires to our subjects, getting information in the internet and conducting interviews personally and honestly with our target subjects to get assurance that our data, information and values gathered were correct and accurate. Conceptual framework INPUT PROCESS OUTPUT Analysis of the input through 1. Distribution of questionnaires 2. Data gathering 3. Statistical treatment 4. Analyzing 5. interpreting | Determined Factors Affecting Academic Performance of Working Students of EARIST | Profile of the respondents: a....

Words: 1519 - Pages: 7

Free Essay

Computer Architecture

... T (p,q,r) = pq’ + p’q = p XOR q | | | | | | | | U (p,q,r) = q’r + qr’ = p XOR r (ii) (d)(i) Multiplexer How it works: * A multiplexer is a combinational circuit which connects multiple input lines to a single output, allowing only a single selected input signal to be passed to the output line at a time. * An Input signal is selected to be passed to output based on selection code which is implemented as two select lines. Typical Inputs and Outputs: * Consider a 4 -to -1 Multiplexer, typical inputs include four input lines labelled C0, C1, C2 and C3, along with two select lines labelled S0 and S1. * Output include single output line labelled F. Labelled diagram of 4-to-1 Multiplexer: (ii) Jk Flip Flop How it works: * A JK flip-flop is a sequential circuit which has two inputs that are similar to that of an S-R flip-flop, however all possible combinations of input values are valid. * If only the J input is asserted, the result is a set function, causing the output to be 1; if only the K input is asserted, the result is a reset function, causing the output to be 0. * When both J and K are 1, the function performed is referred to as the toggle function: the output is complemented. Thus, if Q is 1 and 1 is applied to J and K, then Q becomes 0. Typical...

Words: 1667 - Pages: 7

Premium Essay

Lean Six Sigma

...Lean Six Sigma Notes Lean ­ cuts down on waste, reduce cycle times Six sigma ­ reduces variation in a process DMAIC: define, measure, analyze, improve, and control define ­ identify project, capture VOC and VOB  measure ­ baseline data metric is critical  analyze ­ find the root cause of your problem (may be many but find the  significant 1, 2, and 3 root causes affecting this project), validate critical  Xs, what really affects the output of the process ­ value added vs non  value added improve ­ develop solution and test solution (pilot/pilot plan) control ­ implement policies and procedures (SOPs) to sustain improvements Process: activity that produces something (information, items, ideas, or notions) for a  customer ­ concerned with quality, cost, or speed value stream = process  value stream map = a process map with raw data on it Project Charter ­ contract between you and the sponsor  ­update this during every phase in DMAIC 1) Draft Problem Statement = Pain of Customer  2) Drafting Goal Statement 3) Complete project scope 4) Draft business impact 5) Project plan 6) Team Selection 7) Signatures (optional) RACI chart (Responsible ­ Commanders, Accountable ­ Staff, Consulted ­ SEM,  Informed)  Project sponsors ­ typically the process owners  Opportunity or problem statement ­ what pain are we feeling? what are they  complaining about? what is not working? Problem should never have the solution in it?  Project scope ­ what authorities do you have? (defines what is in scope and out of ...

Words: 471 - Pages: 2

Free Essay

Java Programming

...A Programmer’s Guide to Java™ SCJP Certification Third Edition This page intentionally left blank A Programmer’s Guide to Java™ SCJP Certification A Comprehensive Primer Third Edition Khalid A. Mughal Rolf W. Rasmussen Upper Saddle River, New Jersey • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sidney • Tokyo • Singapore • Mexico City Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales (800) 382-3419 corpsales@pearsontechgroup.com For sales outside the United...

Words: 15086 - Pages: 61

Free Essay

Differential Manchester Encoding

...are two possible waveforms for any data stream depending upon the initial conditions). This gives us the following sample test data assuming pairs of logic levels for one actual bit: Data 1 1 0 0 1 0 1 1 Differential 01 10 10 10 01 01 10 01 Manchester (1) Differential 10 01 01 01 10 10 01 10 Manchester (2) After Halsall 2. Design Steps The output is toggling which suggests a flip flop. If Data = ‘0’ Output = Clock or inverse clock If Data = ‘1’ Output = 2 on –ve clock or inverse 2 on –ve clock Hence the output must be made up of two AND gates and an OR gate to select either * clock or inverse clock when Data = ‘0’ or * 2 on –ve clock or inverse 2 on –ve clock if Data = ‘1’ By De Morgan’s theorem (A.B)+(C.D) = (A.B).(C.D) So we can use three 2 input NAND gates instead of two 2 input AND gates and one 2 input OR gate. Finally we need to flesh out the additional circuitry required. 3. Test Data set The actual test data needs to be more along the following lines: Data 0 0 0 0 0 0 0 Output 10 10 10 10 10 10 10 01 01 01 01 01 01 01 Data 1 1 1 1 1 1 1 Output 01 10 01 10 01 10 01 10 01 10 01 10 01 10 Data 0 1 0 1 0 1 0 Output 10 01 01 10 10 01 01 01 10 10 01 01 10 10 4. Circuit Check the following circuit to see if it meets the requirements of 3. above? The two buffers with inverted signal inputs are “tri-state buffers”. When the input signal from the D type flip...

Words: 429 - Pages: 2