


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
The concept of streams in c++ for performing input and output operations. It covers cin and cout, i/o manipulators, and arithmetic operators. Code examples and explanations of how to use these features in c++.
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!
#include
int main() {
cout << "Hello World! " ;
}
#include
int main() { float x,y;
cout << "Please enter a value for x: " ; cin >> x; cout << "Please enter a value for y: " ; cin >> y; cout << "Values of x and y are:\n" ; cout << "\tx = " << x << " \ty = " << y << '\n' ;
#include
int main () { double f =3.14159; double d = 2; std::cout << std::setprecision(5) << f << '\n'; std::cout << std::setprecision(9) << f << '\n'; std::cout << std::setprecision(9) << d << '\n'; //std::cout << std::showpoint; std::cout << std::showpoint << std::setprecision(5) << f << '\n'; std::cout << std::showpoint << std::setprecision(9) << f << '\n'; std::cout << std::showpoint << std::setprecision(9) << d << '\n'; //std::cout << std::fixed; std::cout << std::fixed << std::setprecision(5) << f << '\n'; std::cout << std::fixed << std::setprecision(9) << f << '\n'; std::cout << std::fixed << std::setprecision(9) << d << '\n'; std::cout << std::scientific << f << '\n'; std::cout << std::scientific << f << '\n'; std::cout << std::scientific << d << '\n'; return 0; }
Output:
2
product*=y; quotient = x; quotient/=y; rem = x; rem%=y; cout << "The sum is " << sum << endl; cout << "The diff is " << diff << endl; cout << "The product is " << product << endl; cout << "The quotient is " << quotient << endl; cout << "The rem is " << rem << endl; }