第二章:开始学习 C++
n”;
}
<<endl; return 0;
}
double C2F(double t)
{
return *t+32;
}

<<endl; return 0;
}
double    convert(double t)
{
return 63240*t;n"; return 0;
}
style(miles per gallon):"<<endl; cout<<Euro_style<<" L/100Km = "<<*Euro_style<<" mpg\n"; return 0;
}
Enter the automobile gasoline consumption figure in
European style(liters per 100 kilometers): Converts to . style(miles per gallon):
L/100Km = mpg
Press any key to continue
style(miles per gallon):"; double US_style;
cin>>US_style;
cout<<"Converts to European style(miles per gallon):"<<endl; cout<<US_style<<" mpg = "<< *US_style<<"L/100Km\n"; return 0;
}
style(miles per gallon):19
Converts to European style(miles per gallon): 19 mpg = 100Km
Press any key to continue
第四章 复合类型

n";
return 0;
}
rand<<endl
<<snack[i].weight<<endl
<<snack[i].calory<<endl<<endl;
}
return 0;
}
rand="A";eight=;
snack[0].calory=200; snack[1].brand="B"; snack[1].weight=; snack[1].calory=400; snack[2].brand="C"; snack[2].weight=;include中文 snack[2].calory=500;
for(int i=0;i<3;i++)
{
cout << " brand: " << snack[i].brand << endl; cout << " weight: " << snack[i].weight << endl;
cout << " calorie: " << snack[i].calory << endl<<endl;
}
delete [] snack; return 0;
}
et(); car* ps=new car[num];
for(int i=0;i<num;++i)
{
cout<<"Car #"<<i+1<<":\n"; cout<<"Please enter the make: "; getline(cin,ps[i].name); cout<<"Please enter the year made: "; (cin>>ps[i].year).get();
}
cout<<"Here is your collection:\n"; for(int i=0;i<num;++i) cout<<ps[i].year<<" "<<ps[i].name<<endl; delete [] ps;
return 0;
}
#include <iostream>
#include <string> using namespace std; struct car
{
string maker; int year;
};
int main()
{

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。