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

📄 assignment3-2_1.cpp

📁 this code is code c++. have many lesson
💻 CPP
字号:
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string bi,de,po1,po2,po3,po4,po5,po6,po7,po8;
    int c;
    cout<<"Please choose the number (1.Convert to Binary/2.Convert to Decimal): ";
    cin>>c;
    if(c==1){
             cout<<"Convert to Binary"<<endl;
             cout<<"Please insert Decimal: ";
             cin>>de;
             po1=de.substr(0,1);
             po2=de.substr(1,1);
             po3=de.substr(2,1);
             po4=de.substr(3,1);
             po5=de.substr(4,1);
             po6=de.substr(5,1);
             po7=de.substr(6,1);
             po8=de.substr(7,7);
             cout<<po1*2*2*2*2*2*2*2<<endl;
             cout<<po2*2*2*2*2*2*2<<endl;
             cout<<po3*2*2*2*2*2<<endl;
             cout<<po4*2*2*2*2<<endl;
             cout<<po5*2*2*2<<endl;
             cout<<po6*2*2<<endl;
             cout<<po7*2<<endl;
             cout<<po8*1<<endl;}
             else if(c==2){
                  cout<<"convert to Decimal"<<endl;}
                  else{
                       cout<<"ERROR"<<endl;}
    system("pause");
    return 0;
}
              

⌨️ 快捷键说明

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