⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cyy.cpp

📁 编码编码编码编码编码编码编码编码编码编码编码编码编码编码编码编码编码
💻 CPP
字号:
 //#include   "stdafx.h"   
  #include   "iostream.h"   
  #include   "iomanip.h"   
  int   main(int   argc,   char*   argv[])   
  {     
  const   int   m=100;   
          int   k,i,j,x;   
  double   y=0;   
      cout<<"please   input   the   number:"<<endl;   
      cin>>k;   
      cout<<"please   input   the   letter:"<<endl;   
      char   a[m],c[m];   
      for(i=0;i<k;i++)   
      cin>>a[i];   
      /*for(i=0;i<k;i++)   
      cout<<a[i]<<"   ";*/   
      cout<<"please   input   the   probability:"<<endl;   
      double     b[m];   
      for(i=0;i<k;i++)   
      {cin>>b[i];y+=b[i];   
      if(b[i]<0||b[i]>1)   
      cout<<"error!";}   
      if(y!=1)   
      cout<<"error!";   
    //for(i=0;i<k;i++)   

    
  //   cout<<b[i]<<"   ";   
      double   low,high,h,t,num,sum;   
      cout<<"请输入左间隔:"<<endl;cin>>low;//cout<<low;   
      cout<<"请输入右间隔:"<<endl;cin>>high;//cout<<high;   
      cout<<"请输入m个系列数:"<<endl;   
      for(i=0;i<m;i++)   
      c[i]='*';   
      for(i=0;i<m;i++)   
      {   
      cin>>c[i];   
      if(c[i]=='*'||c[i]>'z'||c[i]<'a')   
      break;   
      }   
      //for(i=0;i<n;i++)   
  //   {   cout<<c[i]<<"   ";}   
    for   (i=0;i<m;i++)   
      {   
      for   (j=0;j<k;j++)   
      {   if(c[i]!=a[j])   
            break;   
      }   
    }   
    for   (i=0;i<m;i++)   
      {   
      for   (j=0;j<k;j++)   
      {   
    
                      if   (c[i]==a[j])   
      {   
    
    h=0;   
      for   (x=0;x<=j;x++)   
      {h+=b[x];}   
      t=high-low;   
      low=low+(h-b[j])*t;   
      high=high-t+h*t;   
      cout<<low<<","<<high<<endl;   
    
      }   
      }   
      }   
    /*cout<<"请输入左间隔:"<<endl;cin>>low;   
      cout<<"请输入右间隔:"<<endl;cin>>high;   
    cout<<"请输入区间范围的数num:"<<endl;   
    cin>>num;   
    while((high-low)>0.0000001)   
    {       
      sum=0;   
    for(i=0;i<k;i++)   
    {       
    sum+=b[i];   
    t=low+(high-low)*sum;   
    if(num<t)   
    {   
    low=low+(high-low)*(sum-b[i]);   
            cout<<setprecision(10)<<low<<",";   
    high=t;   
          cout<<setprecision(10)<<high<<",";   
    cout<<a[i]<<endl;   
    break;   
    }   
    }   
  }*/return   0;   
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -