page56

// page56.cpp : 定义控制台应用程序的入口点。
//C++ 面向对象程序设计 

#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
 int hours ;
 double gross_pay , rate;
 cout << " Enter the hourly rate of pay : $";
 cin >> rate ;
 cout << " Enter the number of hours worked.\n"
       << " rounded to a whole number of hours :";
 cin >> hours;

 if (hours >40)
 {
  gross_pay = rate * 40 + 1.5 * rate * ( hours - 40 );
 }
 else
 {
  gross_pay = rate * hours ;
 }
 cout.setf(ios::fixed);//以定点格式显示浮点数
 cout.setf(ios::showpoint);//显示浮点数的小数点和后面的0
 cout.precision(2);//既是设置精度的,2表示小数点后将最大显示2位
 cout << " Hours = " << hours << endl;
 cout << "Hourly pay rate = $ " << rate << endl;
 cout << " Gross pay = $ " << gross_pay << endl;

 cin >> rate;//这里设置一下  让它能现实出效果来

 return 0;

}

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
如果您使用的是 Pyecharts 2.0.3 版本,您需要注意到页面 (Page) 和选项卡 (Tab) 是不兼容的。在 Pyecharts 2.0.3 中,如果您在页面中使用选项卡,可能会导致页面无法正常渲染。 如果您需要在 Pyecharts 2.0.3 中使用选项卡,可以尝试使用以下方法: 1. 使用 Pyecharts 1.x 版本。在 Pyecharts 1.x 中,页面和选项卡是兼容的,并且您可以使用以下示例代码将选项卡添加到页面中: ```python from pyecharts import Bar, Line, Pie from pyecharts import options as opts from pyecharts.charts import Tab, Page # 创建柱状图、折线图、饼图 bar = Bar() bar.add_xaxis(["A", "B", "C", "D", "E"]) bar.add_yaxis("data", [5, 20, 36, 10, 75]) bar.set_global_opts(title_opts=opts.TitleOpts(title="Bar Chart")) line = Line() line.add_xaxis(["A", "B", "C", "D", "E"]) line.add_yaxis("data", [25, 10, 56, 20, 35]) line.set_global_opts(title_opts=opts.TitleOpts(title="Line Chart")) pie = Pie() pie.add("", [("A", 30), ("B", 35), ("C", 25), ("D", 15)]) pie.set_global_opts(title_opts=opts.TitleOpts(title="Pie Chart")) # 创建选项卡 tab = Tab() tab.add(bar, "Bar Chart") tab.add(line, "Line Chart") tab.add(pie, "Pie Chart") # 创建页面 page = Page() page.add(tab) # 渲染图表 page.render("page_with_tabs.html") ``` 2. 使用 Pyecharts 2.0.3 中的 Grid 组件。在 Pyecharts 2.0.3 中,您可以使用 Grid 组件来创建类似于选项卡的效果。以下是一个示例代码,演示如何使用 Grid 组件创建多个图表: ```python from pyecharts.charts import Bar, Line, Pie from pyecharts import options as opts from pyecharts.globals import ThemeType from pyecharts.commons.utils import JsCode from pyecharts.components import Grid # 创建柱状图、折线图、饼图 bar = ( Bar(init_opts=opts.InitOpts(theme=ThemeType.LIGHT)) .add_xaxis(["A", "B", "C", "D", "E"]) .add_yaxis("data", [5, 20, 36, 10, 75]) .set_global_opts(title_opts=opts.TitleOpts(title="Bar Chart")) ) line = ( Line(init_opts=opts.InitOpts(theme=ThemeType.LIGHT)) .add_xaxis(["A", "B", "C", "D", "E"]) .add_yaxis("data", [25, 10, 56, 20, 35]) .set_global_opts(title_opts=opts.TitleOpts(title="Line Chart")) ) pie = ( Pie(init_opts=opts.InitOpts(theme=ThemeType.LIGHT)) .add("", [("A", 30), ("B", 35), ("C", 25), ("D", 15)]) .set_global_opts(title_opts=opts.TitleOpts(title="Pie Chart")) ) # 创建 Grid 组件 grid = Grid( init_opts=opts.InitOpts(theme=ThemeType.LIGHT), width="100%", height="100%", page_title="Grid Component", ) # 将三个图表添加到 Grid 组件中 grid.add(bar, grid_opts=opts.GridOpts(pos_left="5%", pos_right="5%", height="50%")) grid.add(line, grid_opts=opts.GridOpts(pos_left="5%", pos_right="5%", top="60%", height="30%")) grid.add(pie, grid_opts=opts.GridOpts(pos_left="5%", pos_right="5%", top="90%", height="10%")) # 渲染图表 grid.render("grid_component.html") ``` 在上面的示例中,我们使用 Grid 组件来创建多个图表。我们将三个图表分别添加到 Grid 组件的不同位置,从而实现了类似于选项卡的效果。 希望这可以帮助您在 Pyecharts 2.0.3 中实现类似于选项卡的效果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值