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

📄 assignment3-2_3.cpp

📁 this code is code c++. have many lesson
💻 CPP
📖 第 1 页 / 共 2 页
字号:
#include<iostream>
#include<string>
using namespace std;
int main()
{
    string hex,h1,h2,h3,h4;
    int c,c1,c2,c3,c4;
    int c11,c22,c33,c44,c55,c66,c77,c88,c99,c10,c111,c12,c13,c14,c15,c16
    ,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16;
    cout<<"Please insert Hexadecimal: ";
    cin>>hex;
    h1=hex.substr(0,1);
    h2=hex.substr(1,1);
    h3=hex.substr(2,1);
    h4=hex.substr(3,1);
    if(h1=="a" || h1=="A"){
         c1=10;}
                   else if(h1=="b" || h1=="B"){
                        c1=11;}
                                  else if(h1=="c" || h1=="C"){
                                       c1=12;}
                                                 else if(h1=="d" || h1=="D"){
                                                      c1=13;}
                                                                else if(h1=="e" || h1=="E"){
                                                                                    c1=14;}
                                                                                    else if(h1=="f" || h1=="F"){
                                                                                         c1=15;}
                                                                                         
                                                                                         else if(h1=="1"){
                                                                                              c1=1;}
                                                                                              
                                                                                              else if(h1=="2"){
                                                                                                   c1=2;
                                                                                                   }
                                                                                                   else if(h1=="3"){
                                                                                                        c1=3;
                                                                                                        }
                                                                                                        else if(h1=="4"){
                                                                                                             c1=4;
                                                                                                             }
                                                                                                             else if(h1=="5"){
                                                                                                                  c1=5;
                                                                                                                  }
                                                                                                                  else if(h1=="6"){
                                                                                                                       c1=6;
                                                                                                                       }
                                                                                                                       else if(h1=="7"){
                                                                                                                            c1=7;
                                                                                                                            }
                                                                                                                            else if(h1=="8"){
                                                                                                                                 c1=8;
                                                                                                                                 }
                                                                                                                                 else if(h1=="9"){
                                                                                                                                      c1=9;
                                                                                                                                      }
                                                                                                                                      else{
                                                                                                                                           c1=0;
                                                                                                                                           }
                                                                                                   
     if(h2=="a" || h2=="A"){
         c2=10;
         }
                   else if(h2=="b" || h2=="B"){
                        c2=11;
                        }
                                  else if(h2=="c" || h2=="C"){
                                       c2=12;
                                       }
                                                 else if(h2=="d" || h2=="D"){
                                                      c2=13;
                                                      }
                                                                else if(h2=="e" || h2=="E"){
                                                                                    c2=14;
                                                                                    }
                                                                                    else if(h2=="f" || h2=="F"){
                                                                                         c2=15;
                                                                                         }
                                                                                         else if(h2=="1"){
                                                                                              c2=1;
                                                                                              }
                                                                                              else if(h2=="2"){
                                                                                                   c2=2;
                                                                                                   }
                                                                                                   else if(h2=="3"){
                                                                                                        c2=3;
                                                                                                        }
                                                                                                        else if(h2=="4"){
                                                                                                             c2=4;
                                                                                                             }
                                                                                                             else if(h2=="5"){
                                                                                                                  c2=5;
                                                                                                                  }
                                                                                                                  else if(h2=="6"){
                                                                                                                       c2=6;
                                                                                                                       }
                                                                                                                       else if(h2=="7"){
                                                                                                                            c2=7;
                                                                                                                            }
                                                                                                                            else if(h1=="8"){
                                                                                                                                 c2=8;
                                                                                                                                 }
                                                                                                                                 else if(h1=="9"){
                                                                                                                                      c2=9;
                                                                                                                                      }
                                                                                                                                      else{
                                                                                                                                           c2=0;
                                                                                                                                           }
      if(h3=="a" || h3=="A"){
         c3=10;
         }
                   else if(h3=="b" || h3=="B"){
                        c3=11;
                        }
                                  else if(h3=="c" || h3=="C"){
                                       c3=12;
                                       }
                                                 else if(h3=="d" || h3=="D"){
                                                      c3=13;
                                                      }
                                                                else if(h3=="e" || h3=="E"){
                                                                                    c3=14;
                                                                                    }

⌨️ 快捷键说明

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