Concept explainers
Discuss the meaning of each of the following objects:
a) std: :cin
b) std: : cout
(a)
To discuss the meaning of std::cin.
Explanation of Solution
cin is an object which is used to read the data from input devices in a C++ program. Here, std is the standard I/O reader. It needs “iostream” header file to be included with preprocessor as #include<iostream>.std::cin is normally connected to the keyboard to input data. Data is inputted by a concatenating stream extraction operator (>gt;).
So, std::cin is used to read input from the user.
(b)
To discuss the meaning of std::cout.
Explanation of Solution
cout is an object which is used to write the output to the console in a C++ program. Here, std is the standard I/O reader. It needs “iostream” header file to be included with preprocessor as #include<iostream>.std::cout is normally connected to screen to output the data.std::cout indicates that the cout is used from “namespace ” std. Data is outputted by a concatenating stream insertion operator (<<).
So,std::cout will send the stream of characters to the standard output stream object.
Want to see more full solutions like this?
Chapter 2 Solutions
Mylab Programming With Pearson Etext -- Access Code Card -- For C++ How To Program (early Objects Version)
- 1-Convert the code below to OOP (Class) 2-give a detail explanation of the code #include <iostream> #include <cmath> #define boardSize 15 #define boardWidth 50 // put into grid the count no of # from x,y void putBlock(char grid[boardSize][boardWidth], int x, int y, int count) { for (int i = 0; i < count; i++) grid[x][y + i] = '#'; } // put into grid the count no of space from x,y void putSpace(char grid[boardSize][boardWidth], int x, int y, int count) { for (int i = 0; i < count; i++) if (grid[x][y + i] != '#') grid[x][y + i] = ' '; } void putCircle(char grid[boardSize][boardWidth], int x, int y) { // line 1 putSpace(grid, x, y, 3); putBlock(grid, x, y + 3, 5); // line 2 putSpace(grid, x + 1, y, 1); putBlock(grid, x + 1, y + 1, 2); putSpace(grid, x + 1, y + 3, 5); putBlock(grid, x + 1, y + 8, 2); // line 3 putBlock(grid, x + 2, y, 1); putSpace(grid, x + 2, y + 1, 9);…arrow_forward2. Write code that uses turtle graphics to draw four concentric circles ofradius 50, 100, 150 and 200.arrow_forwardTo start the emacs editor, the user needs to type _____. Choose an answer A Ctrl+emacs B Ctrl+s C emacs D Ctrl+earrow_forward
- (CODE MUST BE WRITTEN IN PYTHON) (NO 'END' PARAMETER AND NO FUNCTIONS), please read carefully This exercise asks you to draw the following target composed of concentric rectangles (view inserted image) A target is composed of n rectangles centered on the middle of the target. These rectangles are of dimensions 3x3, 7x7, 11x11 and so on. The largest rectangle is composed of characters "1", the second largest of characters "2", and so on. All other characters are spaces. The character in the center of the target is always a space, and the characters around the target are always "1". You should draw a target consisting of 3 rectangles by printing it in the console. However, it should be easy to change the number of rectangles, so that you can draw a different target. You can assume, however, that the number of rectangles requested will always be between 1 and 9 inclusive, since the rectangles must be composed of the numbers 1 to 9. The target must be drawn in a single call to print. You…arrow_forwardUsing Python3, encode the following: Constraints: 15 lines only excluding comments and white space.arrow_forwardprogram that reads two vectors and calculate the angle in radius between these two vectors , Visual studio code , C++arrow_forward
- 23. In C programming language, write a program to input the radius of a sphere and display the difference between the surface area of the sphere and the area of a circle having the same radius.arrow_forwardC++ Please use #include And also include a character arrayarrow_forward1.Which of the following statements about the rule for naming an object is INCORRECT? • Can start with an underscore • Can start with lower case letter • Can start with number 2. Which of the following statements is CORRECT? • Python use ':' and indentation to indicate start of code block • The indentation level for same block can be different. • Python use {} to indicate blocks of codearrow_forward
- What was the use of "using namespace std;" in your programs? Why is it important to have the "using namespace std;" in your programs?arrow_forwardPython exercice. consider the atttached file for further details. Old-fashioned photographs from the nineteenth century are not quite black and white and not quite color, but seem to have shades of gray, brown, and blue. This effect is known as sepia, as shown in the figures below. Original Sepia Original Image & Sepia Image Write and test a function named sepia that converts a color image to sepia. This function should first call grayscale to convert the color image to grayscale. A code segment for transforming the grayscale values to achieve a sepia effect follows.Note that the value for green does not change. (red, green, blue) = image.getPixel(x, y)if red < 63: red = int(red * 1.1) blue = int(blue * 0.9)elif red < 192: red = int(red * 1.15) blue = int(blue * 0.85)else: red = min(int(red * 1.08), 255) blue = int(blue * 0.93) images.py To instantiate an image from a file, enter image = Image(aGifFileName) To…arrow_forwardPlease use Python Programming. Write the code for an application to convert and display a (decimal) number in binary and hexadecimal notation: (see image resource 1) Note that the binary and hexadecimal equivalents should be displayed as LCD numbers. Hint: Use the QLCDNumber class. If the user enters an invalid integer, an error message like the following should be displayed: (see image resource 2) Similarly, if there is an overflow in the number of digits displayed for the binary representation, an appropriate error message should be displayed. Use signals and slots to connect the various buttons to the appropriate functions. Submit the code of all classes that you write, as well as the main program that creates and shows the GUI window. Submit images of the application while it is running to show that it works as required.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning