Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Stream2
//g++ 7.4.0 ////////////////////////////////////////////////////////////////////////////// //Stream2 //this code is created by Rezaul Hoque on July 19,2022;contact: jewelmrh@yahoo.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; ////////////////////////////////////////////////////////////////////////////// #include <fstream> #include <iostream> #include <iomanip> #include <string> #include <strstream> //stream manipulator std::ostream& l(std::ostream& os) { return (os<<"\n"); } int main() { std::cout.width(25); std::cout.fill('>'); std::cout<<l; std::cout.put('J').put('u').put('l').put(' y').put(' ').put('1').put('9').put(',').put('2').put('0').put('2').put('2').put('\n'); const double hr=17; std::cout.setf(std::ios::showpoint); std::cout<<"\nTime: "<<hr<<" hours"<<l; std::ostrstream o; o<<":::More stream examples:::"<<l<<std::ends; o.freeze(0); std::cout<<o.str(); char a[30]="Another stream "; std::ostrstream o2(a,sizeof a,std::ios_base::app); o2<<" example :"<<std::ends; std::cout<<o2.str()<<l; o2.freeze(false); std::istrstream s("12.50 2 50"); double price; double quantity; double charge; std::cout.setf(std::ios::fixed,std::ios::floatfield); std::cout<<std::setprecision(2); if(s>>price>>quantity>>charge) std::cout<<"price: "<<price<<l<<"quantity: "<<quantity<<l<<"charge: "<<charge<<l<<"total cost: "<<price*quantity+charge<<l; std::cout<<l; std::cout.width(25); std::cout.fill('<'); std::cout<<"\n"; return 0; }
run
|
edit
|
history
|
help
0
kap03_09
Merge problem
ignat
UtilityPair2
hack qus
multiply_without_asterisk
EqualIdentical
HeapSort
diamond
Exempel 2