分段函数项目

来源:互联网 发布:企鹅ico软件图标 编辑:程序博客网 时间:2024/06/10 08:23

/* * Copyright (c) 2011, 烟台大学计算机学院

* All rights reserved. * 作 者:马德鹏

* 完成日期:20123年10 月31 日

* 版 本 号:v1.0

#include <iostream>
using namespace std;

int main()
{
   int x,y;
   cin>>x;
   if (x<1)
   {
    y=x;
    cout<<"y="<<y<<endl;
   }
   if (x>=1&&x<10)
   {
    y=2*x-1;
    cout<<"y="<<y<<endl;
   }
   else
    y=3*x-11;
    cout << "y="<<y<<endl;
   iostream>
 return 0;
}include <

原创粉丝点击