#include <iostream> #include <fstream> #include <cstdlib> #include <string> using namespace std; struct patron { double mon; string name; }; int main() { int num,count1=0,count2=0; ifstream fin; char filename[20]; cout<<"…
#include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using namespace std; int main() { char filename[SIZE]; char ch; ifstream inFile;//inFile 是有一个ifstream对象 cout<<"Enter name of file: "; cin.get(fi…
#include <iostream> #include <string> #include <cctype> using namespace std; int main() { string words; int yy=0; int fy=0; int other=0; cout<<"Enter words (q to quit):\n"; while(cin>>words) { if(isalpha(words[0]))…
#include <iostream> #include <string> using namespace std; const int MSIZE=100; struct juankuan { string name; double mon; }; int main() { int num; (cin>>num).get(); int *c1=new int[num];//存储捐款超过10000的捐款个体 int count1=0;//记录捐款超过10000的个数 i…
#include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int N3=5000; int main() { double salary; double sui=0; cout<<"Enter the salary: "; while(cin>>salary && salary>=0) { if(salary…
#include <iostream> using namespace std; const int strsize=30; const int BOPSIZE=5; void showmenu() { cout<<"Benevolent Order of Programmers Report\n" "a. display by name b. display by title\n" "c. display by bopname d…
#include <iostream> using namespace std; void showmenu(void) { cout<<"Please enter one of the following choices:\n" "c) carnivore p) pianist\n" "t) tree g) game\n"; } void ak(void) { cout<<"Please enter…
#include <iostream> #include <cctype> using namespace std; const int MAXSIZE=10; int main() { double dd[MAXSIZE]; double donation; double aver=0; int num=0; int i=0; while(i<MAXSIZE && cin>>donation && !isdigit(donatio…
#include <iostream>#include <cctype>using namespace std;int main(){ char ch; while((ch=cin.get())!='@') {  if(isdigit(ch))   continue;  else if(islower(ch))   ch-='z'-'Z';  else if(isupper(ch))   ch+='z'-'Z';  cout<<ch; } system("pa…
#include <iostream>using namespace std;int main(){ int num; cout<<"Enter number of rows: "; (cin>>num).get(); for(int i=1;i<=num;i++) {  for(int j=num-i;j>0;j--)   cout<<".";  for(int k=1;k<=i;k++)   co…
#include <iostream>#include <string>using namespace std;int main (){ string words; int i=0; cout<<"Enter words (to stop, type the word done):\n"; (cin>>words).get(); while(words!="done") {  i++;  (cin>>wor…
#include <iostream>#include <cstring>const MAXSIZE=100;using namespace std;int main (){ char words[MAXSIZE]; int i=0; cout<<"Enter words (to stop, type the word done):\n"; (cin>>words).get(); while(strcmp(words,"done…
#include <iostream>#include <string>using namespace std;struct car{ string pro; int  year;};int main(){ int num; cout<<"How many cars do you wish to catalog? "; (cin>>num).get();//注意将输入后的回车键转换成的换行符读取并丢弃 car *newcar=new ca…
#include <iostream>using namespace std;const MAXSIZE=12;const year=3;int main(){ char *month[MAXSIZE]={"Janury","February","March","April","May","June","July","August",&…
#include <iostream>using namespace std;const MAXSIZE=12;int main(){ char *month[MAXSIZE]={"Janury","February","March","April","May","June","July","August","Septembe…
#include <iostream>using namespace std;int main(){ double count=0; long double cleo=100; long double dap=100; do {  cleo+=cleo*0.05;  dap+=10;  count++; }while(cleo<dap); cout<<"经过"<<count<<"年,cleo的财富 "<&l…
#include <iostream>using namespace std;const int MAXSIZE=100;int main(){ int a[MAXSIZE]; int sum=0; for(int i=0;i<MAXSIZE;i++) {  cin>>a[i];  if(a[i]==0)   return 0;     sum=sum+a[i];  cout<<"sum= "<<sum; } system(&quo…
#include <iostream>using namespace std;int main(){ int min,max; cout<<"Enter the min: "; cin>>min; cout<<"Enter the max: "; cin>>max; int sum=0; for(int i=min;i<=max;i++)  sum+=i; cout<<"The…
#include <iostream>#include <string>using namespace std;struct CandyBar{ //string kind; char kind[20]; float weight; double calory;};void Display(CandyBar ca,int n){    cout<<"The kind of ca["<<n<<"] is: "…
#include <iostream>using namespace std;const int Size=20;struct Pizza{ char company[Size]; double diameter; double weight;};int main(){ Pizza *piz=new Pizza;//使用new创建动态结构 cout<<"What's the diameter of pizza: "; cin>>piz->dia…
#include <iostream>using namespace std;struct Pizza{ char company[50]; float diameter; float weight;};int main(){ Pizza piz; cout<<"Enter the company name: "; cin.getline(piz.company,50); cout<<"The name of pizza company i…
#include <iostream>using namespace std;struct CandyBar{ char kind[20]; float weight; int calory;};void Display(CandyBar ca,int n){    cout<<"The kind of ca["<<n<<"] is: "<<ca.kind<<endl; cout<<…
#include <iostream>using namespace std;struct CandyBar{ char kind[20]; float weight; int calory;}; int main(){ CandyBar snack= {  "Mocha Munch",  2.3,  350 }; cout<<"The kind of snack is: "<<snack.kind<<endl; co…
#include <iostream>#include <string>using namespace std;int main(){ string fname; string lname; string name; cout<<"Enter your first name: "; getline(cin,fname); cout<<"Enter your last name: "; getline(cin,lname…
#include <iostream>#include <cstring>using namespace std;int main(){ char fname[20]; char lname[20]; char name[45]; cout<<"Enter your first name: "; cin.getline(fname,20); cout<<"Enter your last name: "; cin.get…
#include <iostream>#include <string>int main(){ using namespace std; string name; string dessert;  cout<<"Enter your name:\n"; getline(cin,name);//存在问题,输入两次Enter键,才会运行后面一句cout语句,待解决 cout<<"Enter your favorite dessert…
#include <iostream>//#include <string>using namespace std;struct stu{ char fname[10];//这里若用string fname char lname[10];//同样这里若用string lname char grade; int age;};int main(){ stu stu1; cout<<"What is first name? "; cin.getline(s…
题目:已知存在两个非递减的有序链表List1和List2,现在需要你将两个链表合并成一个有序的非递增序列链表List3,请用C++编码实现.(所有链表均为单链表结构) 思路:此处链表是否都有表头并没有规定. 1:将链表List1和List2合并成一个非递减有序链表List3: 2:再将链表List3进行逆序,即可. #include <iostream>using namespace std;typedef int ElemType;typedef struct LNode{ ElemType…
#include <iostream>using namespace std;char *mystrcat(const char *str1,const char *str2){ char *dst; dst=(char *)malloc(sizeof(str1)+sizeof(str2)); char *start=dst; while(*dst=*str1) {  dst++;  str1++; } while(*dst=*str2) {  dst++;  str2++; } *dst='…
#include <iostream>using namespace std;int mystrcmp(const char *str1,const char *str2){ assert(*str1!='\0' && *str2!='\0'); while(*str1!='\0' && *str2!='\0' && *str1==*str2) {  str1++;  str2++; } return *str1-*str2;}int main(…