#include <iostream>;
#include <cmath>;
#include <string>;
#include <cstring>;
//定义常量 注:没有类型,后面没有 ;
#define RESULT_MAX 888
void toast(int number);
int add(int a,int b);
/*
定义结构体
包括三个结构成员。
注:每个成员之后都有一个 ;
注:{}后面还有一个 ;
*/
struct inflater{
char name[20];
float volume;
double price;
};
int main(){
using namespace std;
//结构体实例 a
//注:后面的不是 ; 而是 , 最后一个后面没有符号
// {}后有一个 ;
inflater a =
{
"zhang liang",
1.5,
10.25
};
//结构体实例 b
// {}后有一个 ;
inflater b =
{
"xiao pang",
2.5,
10.35
};
//结构体的使用
cout << a.name << " and " << b.name << endl;
cout << "both price is = " << a.price + b.price << endl;
//常量输出
cout << RESULT_MAX;
return 0;
}
void toast(int number){
using namespace std;
cout << "The number is " << number <<endl;
}
int add(int a,int b){
return a + b;
}