Input and Output Constructs
Input and Output Constructs
Input and Output Constructs
I/O Constructs
Unsigned integers can be read and written using the I, B, O, and Z edit
descriptors.
They can also be read and written using list-directed and namelist I/O. The
written form of an unsigned integer under list-directed or name list I/O is the
same as is used for positive signed integers.
Unsigned integers can also be read or written using unformatted I/O.
Input Stream: If the direction of flow of bytes is from the device (for
example, Keyboard) to the main memory then this process is called input.
Output Stream: If the direction of flow of bytes is opposite, i.e. from main
memory to device (display screen) then this process is called output.
include <iostream>
int main()
cout << sample << " - A computer science portal for geeks";
return 0;
Output:
GeeksforGeeks - A computer science portal for geeks
#include <iostream>
int main()
int age;
return 0;
Input :
18
Output:
Enter your age:
Your age is: 18
#include <iostream>
int main()
return 0;
}
Output:
An error occurred
Buffered standard error stream (clog): This is also an
instance of ostream class and used to display errors but unlike
cerr the error is first inserted into a buffer and is stored in the
buffer until it is not fully filled. or the buffer is not explicitly
flushed (using flush()). The error message will be displayed on
the screen too.
C++
#include <iostream>
int main()
return 0;
}
Output:
An error occurred
Topic:
Concept of Modularization:
We often have the need to perform a specific task that might be used in
many programs.
//lines of code;
return <value>;
}
//lines of code;
return <value>;
//lines of code
return <value>
Program Layout:
Key Terms:
braces
Used to identify a block of code in languages such as C++, C#, Java,
and JavaScript.
function
What modules are called in many predominant programming
languages of today.
function call
A function’s using or invoking of another function.
function definition
The code that defines what a function does.
function prototype
A function’s communications declaration to a compiler.
identifier name
The name given by the programmer to identify a function or other
program items such as variables.
modularization
The ability to group some lines of code into a unit that can be
included in our program.
parameter passing
How the data is communicated in to and out of a function.
program control
Functions used to simply subdivide and control the program.
specific task
Functions designed to be used with several programs.