Answer:
Difference between "cin" & "cout" is:
"cout"
"cin"It stands for console output. Console means the computer display screen. The 'cout' is a predefined object. It is used as an output statement to display output on the computer screen. It I a part of iostream header file.
Flow of data from one location to another location is called stream .The 'cout' is the standard output stream.
The syntax of 'cout' is;
cout<< const1/vari1,.........................;
cout name of output stream object.
<< put to operator or insertion operator. It directs the output to the output device.
const1/var1, These are the constants and variables that are used to show output on the screen.
For e.g.
cout<<"one kilobyte="<<1024<<" bytes";
In above example two string constants, one numeric constant and three put to operators are used and its output will be: One kilobyte= 1024 bytes.
It stands for console input. It is an input stream. It is used as input statement to get input from the keyboard during execution of the program.
When an input statement is executed, the computer waits to receive an input from the keyboard. When the value is typed and enter key is pressed the value is assigned to the variable and control shifts to next statement.
It is also the part of iostream header file.
The syntax of 'cin' is:
cin>>var1 [>>var2...];
cin represents the object used as an input stream and gets the value from keyboard.
>> Extraction operator or get from operator. Its get an input from the input device and assigned t the variable.
var1, var2 represents list of variables and each variable I separated by '>>'
At least one variable on the right-hand-side of the ">>"operator must be used.
For e.g.
cin>>a>>b>>c;
std::cout<<42<<std::endl;
I believe, you can use C-function - printf().
std::cout<<"computer"<<std::endl;
#include <iostream.h> main() { int a; cout<<"enter a number : "; cin>>a; cout<<endl; if (a%2-1) cout<<"it is a prime number"; else cout<<"it is not a prime number" return 0; } ------------------------------------------ output: enter a number : 30 it is a not a prime number
#include<iostream> int main() { std::cout << "Your name"; }
cout<<"______": cin >>__>>__; [example cout<<"enter no."; cin>>a>>b; ]
#include<iostream> int main() { using namespace std; char c='A'; do { cout<<c; }while(c++<'Z'); cout<<endl; }
std::cout<<42<<std::endl;
I believe, you can use C-function - printf().
#include<iostream> int main() { int num1, num2; std::cout << "C++ addition program" << std::endl; std::cout << "Enter a number: "; std::cin >> num1; std::cout << "Enter another number: "; std::cin >> num2; std::cout << "The sum is " << num1 + num2 << std::endl; }
std::cout<<"computer"<<std::endl;
#include <iostream.h> main() { int a; cout<<"enter a number : "; cin>>a; cout<<endl; if (a%2-1) cout<<"it is a prime number"; else cout<<"it is not a prime number" return 0; } ------------------------------------------ output: enter a number : 30 it is a not a prime number
#include<iostream> int main() { std::cout << "Your name"; }
#include<iostream> in main() { std::cout << "Hello World\n"; }
#include<iostream> int main() { int x=0, y=1; std::cout<<x<<" "; std::cout<<y<<" "; while( y<1000000 ) { std::cout<<(y+=x)<<" "; x=y-x; } std::cout<<std::endl; return(0); }
#include<iostream> int main() { int x=0, y=1; std::cout<<x<<" "; std::cout<<y<<" "; while( y<1000000 ) { std::cout<<(y+=x)<<" "; x=y-x; } std::cout<<std::endl; return(0); }
#include#includemain(){clrscr();coutb;cout