#include <stdio.h>
#include <math.h>
void city_tel()//计算市话费用
void long_dist()//计算长途费用
void main()
{
short flag//flag==1:市话;flag==0:长途
flag=1//初始值是市话
printf("选择市话请哪袭输入塌枯1,选择长李衫兄途请输入2:\n")
scanf("%d",&flag)
if (flag==1) city_tel()
else long_dist()
}
void city_tel()
{
double money=0
int minute,second
printf("输入通话时间(包含分/秒):\n")
printf("分:")
scanf("%d",&minute)
printf("秒:")
scanf("%d",&second)
if (second>0||second<=60) minute+=1
if (minute<=3)
{
money=0.28
}
else money=0.28+(minute-3)*0.11
printf("您的话费是:%0.2f\n",money)
}
void long_dist()
{
double money
int minute,second
printf("输入通话时间(包含分/秒):\n")
printf("分:")
scanf("%d",&minute)
printf("秒:")
scanf("%d",&second)
if (second>0||second<=60) minute+=1
money=minute*1.2
printf("您的话费是:%0.2f\n",money)
}
(2)
#include <iostream>
class Income
{
public:
Income()
int total()
void getbicycle(int a)
void getmotorcycle(int b)
private:
int bicycle
int motorcycle
}
Income::Income()
{
bicycle=0
motorcycle=0
}
int Income::total()
{
return(bicycle*220+motorcycle*3000)
}
void Income::getbicycle(int a)
{
bicycle=a
}
void Income::getmotorcycle(int b)
{
motorcycle=b
}
void main()
{
Income in
int a,b
printf("请输入今天的销售量:\n自行车(辆):")
scanf("%d",&a)
in.getbicycle(a)
printf("摩托车(辆):")
scanf("%d",&b)
in.getmotorcycle(b)
printf("今天的营业额是:%d\n",in.total())
}
菜单栏里点击“插入”
之后在下拉菜单里点击“资源”,选择下边要用到的资源,比如要往程序里添加图标,则点“Icon”后在右边点新建,下面画出你想要的图标,之后点击菜单栏里的“文件”,再下拉菜单"保存",将资源保存到你所建工程里,之念坦后再把资源文件调价到程序里边,具体过程如下:菜单栏
“工程”---下粗腊拉菜单“增加到工程”
选择“文件“岩高滑
把自动生成的”resource.h“和”Script1.rc“加入其中,”确定“
最后在含WinMain函数的cpp问价里改一点代码就行了
1.#include
"resource.h"
2,wndclass.hIcon
=
LoadIcon
(NULL,
IDI_APPLICATION)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)