SlideShare a Scribd company logo
1 of 5
Download to read offline
// operating system Ubunut,Linux,Mac
// filename messageService.cpp
#include
#include // for vector
#include
using namespace std;
/*Main function start*/
int main()
{
std::vector > store;// we are using vector for storing pair of name and message
std::vector >::reverse_iterator it;// used to reverse iteration
std::string name,message,input,choice;// variable for purpose
do{
std::cout<<"Enter User Name> ";
std::cin>>name;
std::cout<<"Enter Message> ";// prompt for user input
/* we are taking input from user as string
* if line contains $$ then it will break and come out from loop
* otherwise it will create pair and insert it into vector*/
while(std::getline(std::cin,input)){
if(input=="$$")
break;
message+=input+" ";
}
store.push_back(std::pair(name,message));// inserting pair into vector
message="";
std::cout<<"Any More Users? > ";
std::cin>>choice;
}while(choice=="yes");
/*while loop break if choice value other then "yes" */
std::cout << "The current messages are:  ";
/*Iterating vector in reverse order for printing desirable output*/
for (it=store.rbegin(); it!=store.rend(); ++it){
std::cout << it->first << " >> "<second << ' ';
}
return 0;
}
/*Main function End*/
/*Output*/
gopal@gopal:~/Desktop/chegg$ g++ messageService.cpp
gopal@gopal:~/Desktop/chegg$ ./a.out
Enter User Name> Kate
Enter Message> Get in the loop and join our War Eagle group!
Sunner in st. John's islands was fun.
How was your summer?
$$
Any More Users? > yes
Enter User Name> Daniel
Enter Message> I'm in!
$$
Any More Users? > yes
Enter User Name> Joey
Enter Message> Count me in.
We were in Tokyo; intersting!
$$
Any More Users? > yes
Enter User Name> Kevin
Enter Message> What's new?
we had a great time in the Outback.
$$
Any More Users? > no
The current messages are:
Kevin >>
What's new?
we had a great time in the Outback.
Joey >>
Count me in.
We were in Tokyo; intersting!
Daniel >>
I'm in!
Kate >>
Get in the loop and join our War Eagle group!
Sunner in st. John's islands was fun.
How was your summer?
Solution
// operating system Ubunut,Linux,Mac
// filename messageService.cpp
#include
#include // for vector
#include
using namespace std;
/*Main function start*/
int main()
{
std::vector > store;// we are using vector for storing pair of name and message
std::vector >::reverse_iterator it;// used to reverse iteration
std::string name,message,input,choice;// variable for purpose
do{
std::cout<<"Enter User Name> ";
std::cin>>name;
std::cout<<"Enter Message> ";// prompt for user input
/* we are taking input from user as string
* if line contains $$ then it will break and come out from loop
* otherwise it will create pair and insert it into vector*/
while(std::getline(std::cin,input)){
if(input=="$$")
break;
message+=input+" ";
}
store.push_back(std::pair(name,message));// inserting pair into vector
message="";
std::cout<<"Any More Users? > ";
std::cin>>choice;
}while(choice=="yes");
/*while loop break if choice value other then "yes" */
std::cout << "The current messages are:  ";
/*Iterating vector in reverse order for printing desirable output*/
for (it=store.rbegin(); it!=store.rend(); ++it){
std::cout << it->first << " >> "<second << ' ';
}
return 0;
}
/*Main function End*/
/*Output*/
gopal@gopal:~/Desktop/chegg$ g++ messageService.cpp
gopal@gopal:~/Desktop/chegg$ ./a.out
Enter User Name> Kate
Enter Message> Get in the loop and join our War Eagle group!
Sunner in st. John's islands was fun.
How was your summer?
$$
Any More Users? > yes
Enter User Name> Daniel
Enter Message> I'm in!
$$
Any More Users? > yes
Enter User Name> Joey
Enter Message> Count me in.
We were in Tokyo; intersting!
$$
Any More Users? > yes
Enter User Name> Kevin
Enter Message> What's new?
we had a great time in the Outback.
$$
Any More Users? > no
The current messages are:
Kevin >>
What's new?
we had a great time in the Outback.
Joey >>
Count me in.
We were in Tokyo; intersting!
Daniel >>
I'm in!
Kate >>
Get in the loop and join our War Eagle group!
Sunner in st. John's islands was fun.
How was your summer?

More Related Content

Similar to operating system Ubunut,Linux,Mac filename messageService.cpp.pdf

香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideSharebiyu
 
Baocao Web Tech Java Mail
Baocao Web Tech Java MailBaocao Web Tech Java Mail
Baocao Web Tech Java Mailxicot
 
Library Project Marcelo Salvador
Library Project Marcelo SalvadorLibrary Project Marcelo Salvador
Library Project Marcelo SalvadorDomingos Salvador
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2Warui Maina
 
Twitter Author Prediction from Tweets using Bayesian Network
Twitter Author Prediction from Tweets using Bayesian NetworkTwitter Author Prediction from Tweets using Bayesian Network
Twitter Author Prediction from Tweets using Bayesian NetworkHendy Irawan
 
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docxUser.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docxdickonsondorris
 
C++ Course - Lesson 3
C++ Course - Lesson 3C++ Course - Lesson 3
C++ Course - Lesson 3Mohamed Ahmed
 
Frequency .java Word frequency counter package frequ.pdf
Frequency .java  Word frequency counter  package frequ.pdfFrequency .java  Word frequency counter  package frequ.pdf
Frequency .java Word frequency counter package frequ.pdfarshiartpalace
 
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfinclude ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfnaslin841216
 
服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScriptQiangning Hong
 
18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operatorSAFFI Ud Din Ahmad
 
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdfCan anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdfarjunhassan8
 
Gérer vos objets
Gérer vos objetsGérer vos objets
Gérer vos objetsThomas Gasc
 

Similar to operating system Ubunut,Linux,Mac filename messageService.cpp.pdf (20)

香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare
 
Baocao Web Tech Java Mail
Baocao Web Tech Java MailBaocao Web Tech Java Mail
Baocao Web Tech Java Mail
 
Library Project Marcelo Salvador
Library Project Marcelo SalvadorLibrary Project Marcelo Salvador
Library Project Marcelo Salvador
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2
 
File handling in c++
File handling in c++File handling in c++
File handling in c++
 
Twitter Author Prediction from Tweets using Bayesian Network
Twitter Author Prediction from Tweets using Bayesian NetworkTwitter Author Prediction from Tweets using Bayesian Network
Twitter Author Prediction from Tweets using Bayesian Network
 
Email Program By Marcelo
Email Program By MarceloEmail Program By Marcelo
Email Program By Marcelo
 
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docxUser.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
User.DS_Store__MACOSXUser._.DS_Store__MACOSXUser._D.docx
 
C++ Course - Lesson 3
C++ Course - Lesson 3C++ Course - Lesson 3
C++ Course - Lesson 3
 
Frequency .java Word frequency counter package frequ.pdf
Frequency .java  Word frequency counter  package frequ.pdfFrequency .java  Word frequency counter  package frequ.pdf
Frequency .java Word frequency counter package frequ.pdf
 
Email Program By Marcelo
Email Program By MarceloEmail Program By Marcelo
Email Program By Marcelo
 
Email Program By Marcelo
Email Program By MarceloEmail Program By Marcelo
Email Program By Marcelo
 
Week 12 code
Week 12 codeWeek 12 code
Week 12 code
 
Oops presentation
Oops presentationOops presentation
Oops presentation
 
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfinclude ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdf
 
part2
part2part2
part2
 
服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript
 
18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator
 
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdfCan anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
Can anyone fix this code, I use Visual StudiosThe Errors im getti.pdf
 
Gérer vos objets
Gérer vos objetsGérer vos objets
Gérer vos objets
 

More from annethafashion

8. D) trapping records kept on non-scientists can provide useful rec.pdf
8. D) trapping records kept on non-scientists can provide useful rec.pdf8. D) trapping records kept on non-scientists can provide useful rec.pdf
8. D) trapping records kept on non-scientists can provide useful rec.pdfannethafashion
 
1. X-linked ichthyosis.............X-linked recessive diseaseSol.pdf
1. X-linked ichthyosis.............X-linked recessive diseaseSol.pdf1. X-linked ichthyosis.............X-linked recessive diseaseSol.pdf
1. X-linked ichthyosis.............X-linked recessive diseaseSol.pdfannethafashion
 
1f=1s+1ptaking 1s to the left1f-1s=1ptaking LCD of f and .pdf
1f=1s+1ptaking 1s to the left1f-1s=1ptaking LCD of f and .pdf1f=1s+1ptaking 1s to the left1f-1s=1ptaking LCD of f and .pdf
1f=1s+1ptaking 1s to the left1f-1s=1ptaking LCD of f and .pdfannethafashion
 
in the beginning he had x denarii. After leaving Lucca he had 2x .pdf
 in the beginning he had x denarii. After leaving Lucca he had 2x .pdf in the beginning he had x denarii. After leaving Lucca he had 2x .pdf
in the beginning he had x denarii. After leaving Lucca he had 2x .pdfannethafashion
 
x^2 = H+ ^2 = 0.61.310^-5 hence H+ = 0.00134 M.pdf
                     x^2 = H+ ^2 = 0.61.310^-5  hence H+ = 0.00134 M.pdf                     x^2 = H+ ^2 = 0.61.310^-5  hence H+ = 0.00134 M.pdf
x^2 = H+ ^2 = 0.61.310^-5 hence H+ = 0.00134 M.pdfannethafashion
 
sp3 Solution sp3 .pdf
                     sp3  Solution                     sp3  .pdf                     sp3  Solution                     sp3  .pdf
sp3 Solution sp3 .pdfannethafashion
 
M=Molalityd=1.59 M .pdf
                     M=Molalityd=1.59 M                              .pdf                     M=Molalityd=1.59 M                              .pdf
M=Molalityd=1.59 M .pdfannethafashion
 
Ibuprofen is a carboxylic acid. It will react wit.pdf
                     Ibuprofen is a carboxylic acid. It will react wit.pdf                     Ibuprofen is a carboxylic acid. It will react wit.pdf
Ibuprofen is a carboxylic acid. It will react wit.pdfannethafashion
 
halogens are nonpolar molecules. water is polar, .pdf
                     halogens are nonpolar molecules. water is polar, .pdf                     halogens are nonpolar molecules. water is polar, .pdf
halogens are nonpolar molecules. water is polar, .pdfannethafashion
 
b. because the physician advertised his services .pdf
                     b. because the physician advertised his services .pdf                     b. because the physician advertised his services .pdf
b. because the physician advertised his services .pdfannethafashion
 
Yes linear model would be appropriateReason a ) linearityof.pdf
Yes linear model would be appropriateReason a ) linearityof.pdfYes linear model would be appropriateReason a ) linearityof.pdf
Yes linear model would be appropriateReason a ) linearityof.pdfannethafashion
 
Use of assembly language[edit]Historical perspective[edit]Assemb.pdf
Use of assembly language[edit]Historical perspective[edit]Assemb.pdfUse of assembly language[edit]Historical perspective[edit]Assemb.pdf
Use of assembly language[edit]Historical perspective[edit]Assemb.pdfannethafashion
 
The five components of internal control are1)Control enviornment .pdf
The five components of internal control are1)Control enviornment .pdfThe five components of internal control are1)Control enviornment .pdf
The five components of internal control are1)Control enviornment .pdfannethafashion
 
a. HF is the most polar molecule Reason because.pdf
                     a. HF is the most polar molecule  Reason because.pdf                     a. HF is the most polar molecule  Reason because.pdf
a. HF is the most polar molecule Reason because.pdfannethafashion
 
In accounting and economics, fair value is a rational and unbiased e.pdf
In accounting and economics, fair value is a rational and unbiased e.pdfIn accounting and economics, fair value is a rational and unbiased e.pdf
In accounting and economics, fair value is a rational and unbiased e.pdfannethafashion
 
it is given cost of wire consider1 centdistance(D)2D3for th.pdf
it is given cost of wire consider1 centdistance(D)2D3for th.pdfit is given cost of wire consider1 centdistance(D)2D3for th.pdf
it is given cost of wire consider1 centdistance(D)2D3for th.pdfannethafashion
 
I will choose the -1.)A widower in her thirties with three small ch.pdf
I will choose the -1.)A widower in her thirties with three small ch.pdfI will choose the -1.)A widower in her thirties with three small ch.pdf
I will choose the -1.)A widower in her thirties with three small ch.pdfannethafashion
 
Facts of the caseCity Transportation Company (CTC) agrees to pick .pdf
Facts of the caseCity Transportation Company (CTC) agrees to pick .pdfFacts of the caseCity Transportation Company (CTC) agrees to pick .pdf
Facts of the caseCity Transportation Company (CTC) agrees to pick .pdfannethafashion
 
First Informers in the Disaster Zone  It hold a summary of the insig.pdf
First Informers in the Disaster Zone  It hold a summary of the insig.pdfFirst Informers in the Disaster Zone  It hold a summary of the insig.pdf
First Informers in the Disaster Zone  It hold a summary of the insig.pdfannethafashion
 
a triple bond is sp hybridised a double bond is .pdf
                     a triple bond is sp hybridised  a double bond is .pdf                     a triple bond is sp hybridised  a double bond is .pdf
a triple bond is sp hybridised a double bond is .pdfannethafashion
 

More from annethafashion (20)

8. D) trapping records kept on non-scientists can provide useful rec.pdf
8. D) trapping records kept on non-scientists can provide useful rec.pdf8. D) trapping records kept on non-scientists can provide useful rec.pdf
8. D) trapping records kept on non-scientists can provide useful rec.pdf
 
1. X-linked ichthyosis.............X-linked recessive diseaseSol.pdf
1. X-linked ichthyosis.............X-linked recessive diseaseSol.pdf1. X-linked ichthyosis.............X-linked recessive diseaseSol.pdf
1. X-linked ichthyosis.............X-linked recessive diseaseSol.pdf
 
1f=1s+1ptaking 1s to the left1f-1s=1ptaking LCD of f and .pdf
1f=1s+1ptaking 1s to the left1f-1s=1ptaking LCD of f and .pdf1f=1s+1ptaking 1s to the left1f-1s=1ptaking LCD of f and .pdf
1f=1s+1ptaking 1s to the left1f-1s=1ptaking LCD of f and .pdf
 
in the beginning he had x denarii. After leaving Lucca he had 2x .pdf
 in the beginning he had x denarii. After leaving Lucca he had 2x .pdf in the beginning he had x denarii. After leaving Lucca he had 2x .pdf
in the beginning he had x denarii. After leaving Lucca he had 2x .pdf
 
x^2 = H+ ^2 = 0.61.310^-5 hence H+ = 0.00134 M.pdf
                     x^2 = H+ ^2 = 0.61.310^-5  hence H+ = 0.00134 M.pdf                     x^2 = H+ ^2 = 0.61.310^-5  hence H+ = 0.00134 M.pdf
x^2 = H+ ^2 = 0.61.310^-5 hence H+ = 0.00134 M.pdf
 
sp3 Solution sp3 .pdf
                     sp3  Solution                     sp3  .pdf                     sp3  Solution                     sp3  .pdf
sp3 Solution sp3 .pdf
 
M=Molalityd=1.59 M .pdf
                     M=Molalityd=1.59 M                              .pdf                     M=Molalityd=1.59 M                              .pdf
M=Molalityd=1.59 M .pdf
 
Ibuprofen is a carboxylic acid. It will react wit.pdf
                     Ibuprofen is a carboxylic acid. It will react wit.pdf                     Ibuprofen is a carboxylic acid. It will react wit.pdf
Ibuprofen is a carboxylic acid. It will react wit.pdf
 
halogens are nonpolar molecules. water is polar, .pdf
                     halogens are nonpolar molecules. water is polar, .pdf                     halogens are nonpolar molecules. water is polar, .pdf
halogens are nonpolar molecules. water is polar, .pdf
 
b. because the physician advertised his services .pdf
                     b. because the physician advertised his services .pdf                     b. because the physician advertised his services .pdf
b. because the physician advertised his services .pdf
 
Yes linear model would be appropriateReason a ) linearityof.pdf
Yes linear model would be appropriateReason a ) linearityof.pdfYes linear model would be appropriateReason a ) linearityof.pdf
Yes linear model would be appropriateReason a ) linearityof.pdf
 
Use of assembly language[edit]Historical perspective[edit]Assemb.pdf
Use of assembly language[edit]Historical perspective[edit]Assemb.pdfUse of assembly language[edit]Historical perspective[edit]Assemb.pdf
Use of assembly language[edit]Historical perspective[edit]Assemb.pdf
 
The five components of internal control are1)Control enviornment .pdf
The five components of internal control are1)Control enviornment .pdfThe five components of internal control are1)Control enviornment .pdf
The five components of internal control are1)Control enviornment .pdf
 
a. HF is the most polar molecule Reason because.pdf
                     a. HF is the most polar molecule  Reason because.pdf                     a. HF is the most polar molecule  Reason because.pdf
a. HF is the most polar molecule Reason because.pdf
 
In accounting and economics, fair value is a rational and unbiased e.pdf
In accounting and economics, fair value is a rational and unbiased e.pdfIn accounting and economics, fair value is a rational and unbiased e.pdf
In accounting and economics, fair value is a rational and unbiased e.pdf
 
it is given cost of wire consider1 centdistance(D)2D3for th.pdf
it is given cost of wire consider1 centdistance(D)2D3for th.pdfit is given cost of wire consider1 centdistance(D)2D3for th.pdf
it is given cost of wire consider1 centdistance(D)2D3for th.pdf
 
I will choose the -1.)A widower in her thirties with three small ch.pdf
I will choose the -1.)A widower in her thirties with three small ch.pdfI will choose the -1.)A widower in her thirties with three small ch.pdf
I will choose the -1.)A widower in her thirties with three small ch.pdf
 
Facts of the caseCity Transportation Company (CTC) agrees to pick .pdf
Facts of the caseCity Transportation Company (CTC) agrees to pick .pdfFacts of the caseCity Transportation Company (CTC) agrees to pick .pdf
Facts of the caseCity Transportation Company (CTC) agrees to pick .pdf
 
First Informers in the Disaster Zone  It hold a summary of the insig.pdf
First Informers in the Disaster Zone  It hold a summary of the insig.pdfFirst Informers in the Disaster Zone  It hold a summary of the insig.pdf
First Informers in the Disaster Zone  It hold a summary of the insig.pdf
 
a triple bond is sp hybridised a double bond is .pdf
                     a triple bond is sp hybridised  a double bond is .pdf                     a triple bond is sp hybridised  a double bond is .pdf
a triple bond is sp hybridised a double bond is .pdf
 

Recently uploaded

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 

Recently uploaded (20)

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

operating system Ubunut,Linux,Mac filename messageService.cpp.pdf

  • 1. // operating system Ubunut,Linux,Mac // filename messageService.cpp #include #include // for vector #include using namespace std; /*Main function start*/ int main() { std::vector > store;// we are using vector for storing pair of name and message std::vector >::reverse_iterator it;// used to reverse iteration std::string name,message,input,choice;// variable for purpose do{ std::cout<<"Enter User Name> "; std::cin>>name; std::cout<<"Enter Message> ";// prompt for user input /* we are taking input from user as string * if line contains $$ then it will break and come out from loop * otherwise it will create pair and insert it into vector*/ while(std::getline(std::cin,input)){ if(input=="$$") break; message+=input+" "; } store.push_back(std::pair(name,message));// inserting pair into vector message=""; std::cout<<"Any More Users? > "; std::cin>>choice; }while(choice=="yes"); /*while loop break if choice value other then "yes" */ std::cout << "The current messages are: "; /*Iterating vector in reverse order for printing desirable output*/ for (it=store.rbegin(); it!=store.rend(); ++it){ std::cout << it->first << " >> "<second << ' ';
  • 2. } return 0; } /*Main function End*/ /*Output*/ gopal@gopal:~/Desktop/chegg$ g++ messageService.cpp gopal@gopal:~/Desktop/chegg$ ./a.out Enter User Name> Kate Enter Message> Get in the loop and join our War Eagle group! Sunner in st. John's islands was fun. How was your summer? $$ Any More Users? > yes Enter User Name> Daniel Enter Message> I'm in! $$ Any More Users? > yes Enter User Name> Joey Enter Message> Count me in. We were in Tokyo; intersting! $$ Any More Users? > yes Enter User Name> Kevin Enter Message> What's new? we had a great time in the Outback. $$ Any More Users? > no The current messages are: Kevin >> What's new? we had a great time in the Outback. Joey >> Count me in. We were in Tokyo; intersting! Daniel >>
  • 3. I'm in! Kate >> Get in the loop and join our War Eagle group! Sunner in st. John's islands was fun. How was your summer? Solution // operating system Ubunut,Linux,Mac // filename messageService.cpp #include #include // for vector #include using namespace std; /*Main function start*/ int main() { std::vector > store;// we are using vector for storing pair of name and message std::vector >::reverse_iterator it;// used to reverse iteration std::string name,message,input,choice;// variable for purpose do{ std::cout<<"Enter User Name> "; std::cin>>name; std::cout<<"Enter Message> ";// prompt for user input /* we are taking input from user as string * if line contains $$ then it will break and come out from loop * otherwise it will create pair and insert it into vector*/ while(std::getline(std::cin,input)){ if(input=="$$") break; message+=input+" "; } store.push_back(std::pair(name,message));// inserting pair into vector message=""; std::cout<<"Any More Users? > "; std::cin>>choice;
  • 4. }while(choice=="yes"); /*while loop break if choice value other then "yes" */ std::cout << "The current messages are: "; /*Iterating vector in reverse order for printing desirable output*/ for (it=store.rbegin(); it!=store.rend(); ++it){ std::cout << it->first << " >> "<second << ' '; } return 0; } /*Main function End*/ /*Output*/ gopal@gopal:~/Desktop/chegg$ g++ messageService.cpp gopal@gopal:~/Desktop/chegg$ ./a.out Enter User Name> Kate Enter Message> Get in the loop and join our War Eagle group! Sunner in st. John's islands was fun. How was your summer? $$ Any More Users? > yes Enter User Name> Daniel Enter Message> I'm in! $$ Any More Users? > yes Enter User Name> Joey Enter Message> Count me in. We were in Tokyo; intersting! $$ Any More Users? > yes Enter User Name> Kevin Enter Message> What's new? we had a great time in the Outback. $$ Any More Users? > no The current messages are:
  • 5. Kevin >> What's new? we had a great time in the Outback. Joey >> Count me in. We were in Tokyo; intersting! Daniel >> I'm in! Kate >> Get in the loop and join our War Eagle group! Sunner in st. John's islands was fun. How was your summer?