怎么做生日贺卡赚钱问?.

  • A+
所属分类:纸盒印刷

怎么做生日贺卡赚钱问?
这是我改过的,首先如果考虑到名字中间有空格的情况,则需要把name定义成string型,那么接收string型变量的语句是getline(cin,变量名);而且你把送祝福的人和接受祝福的人,名字的位置你给写反了。改过之后就OK啦~
#include <iostream>
#include<string>
using namespace std;
int main ( )
{
string name1,name2,name3,name4,name5,name6,name7,name8,name9,name10,name11,name12;
cout<<endl<<"请输入你好友的名字,随意哦:";
getline(cin,name1);
cout<<endl<<"请输入你自己的名字:";
getline(cin,name2);
cout<<endl<<"==========================="<<endl;
cout<<"my dear "<<name1<<","<<endl;
cout<<"祝你生日快乐!"<<endl;
cout<<" yours,"<<endl;
cout<<" "<<name2<<endl;
cout<<"========================="<<endl;
cout<<endl<<"请再输入一个好友的名字吧";
getline(cin,name3);
cout<<endl<<"请输入你自己的名字again:";
getline(cin,name4);
cout<<endl<<"========================="<<endl;
cout<<"my dear "<<name3<<","<<endl;
cout<<"祝你天天开心!"<<endl;
cout<<" yours,"<<endl;
cout<<" "<<name4<<endl;
cout<<"======================="<<endl;
//多输几个名字吧
cout<<endl<<"再输个好友的名字吧:";
getline(cin,name5);
cout<<endl<<"请输入你自己的名字again and again:";
getline(cin,name6);
cout<<endl<<"=========================="<<endl;
cout<<"my dear "<<name5<<","<<endl;
cout<<"祝你学习进步"<<endl;
cout<<" Yours,"<<endl;
cout<<" "<<name6<<endl;
cout<<"========================"<<endl;
cout<<endl<<"还有啊,再输个好友名字吧";
getline(cin,name7);
cout<<endl<<"请输入你自己的名字(你输烦了吧?):";
getline(cin,name8);
cout<<endl<<"============================"<<endl;
cout<<"my dear "<<name7<<","<<endl;
cout<<"祝你越长越漂亮!"<<endl;
cout<<" yours,"<<endl;
cout<<" "<<name8<<endl;
cout<<"==========================="<<endl;
cout<<endl<<"输入我的名字吧:";
getline(cin,name9);
cout<<endl<<"请输入你自己的名字the last time:";
getline(cin,name10);
cout<<endl<<"=========================="<<endl;
cout<<"my dear "<<name9<<","<<endl;
cout<<"写这个东西,只是为了表达我的祝福,希望你能开心就好,我的水平有限,你就将就着看吧"<<endl;
cout<<" yours"<<endl;
cout<<" "<<name10<<endl;
cout<<"=========================="<<endl;
cout<<endl<<"输入你生日,? 月";
getline(cin,name11);
cout<<endl<<"输入你生日,? 日";
getline(cin,name12);
cout<<endl<<"=============================="<<endl;
cout<<"哈哈。没错!就是"<<name11<<" 月 "<<name12<<"日"<<endl;
cout<<"生日快乐!"<<endl;
cout<<"================================"<<endl;
system("pause");
}本回答被网友采纳

weinxin
广州千度包装印刷微信
扫码微信马上报价

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: