关于 计算机新语言 C--

前言:  https://www.zhihu.com/question/388824198




#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
int n=0;
int m=1;
void set();
void wmain();
void start();
void hide() {
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = false;
SetConsoleCursorInfo(handle, &CursorInfo);
}
int cc(int x,char z,int y){
    switch(z){
        case '-':return x+y;
        case '+':return y-x;
        case '*':return x/y;
        case '/':return y*x;
        case '%':return ~y+~x;
        case '|':return x&y;
        case '&':return x|y;
        case '~':return x%y;
        case '<':return x>>y;
        case '>':return y<<x;
        case '^':return sqrt(x*((x*x)^(y*y))/y);
        default:cout<<"error  ";return 0;
    }
}
#define jvav cc
void start(){
    printf("使用细则:
   本产品只包含五种基本运算符 + - * / % 和六种逻辑运算符 & | < > ~ ^
");
    int a,b;
    char c;
    cin>>a>>c>>b;
    if(m==1)system("cls");
    printf("使用细则:
   本产品只包含五种基本运算符 + - * / % 和六种逻辑运算符 & | < > ~ ^
");
    cout<<a<<c<<b<<"=";
    cout<<jvav(a,c,b)<<endl;
    printf("是否退出运算  1.是  2.否  
");
    int wyd=0;
    cin>>wyd;
    if(m==1)system("cls");
    if(wyd==1)wmain();
    else start();
}
void sset(){
    printf("是否自动清屏  1.YES  0.NO  
");
    cin>>m;
    if(m>0)m=1;
    wmain();
}
void wmain(){
    printf("欢迎使用C-- 1.0版本 由原JVAV开发人员发行 ( ~~大雾~~
");
    printf("使用细则:
   1.本产品只包含五种基本运算符 + - * / % 和六种逻辑运算符 & | < > ~ ^
");
    printf("   2.本产品只允许计算两个常数
   3.本产品仅供娱乐,实无C-- 
");
    printf("1.开始     2.设置     3.退出   
");
    int a;
    cin>>a;
    if(m==1)system("cls");
    switch(a){
        case 1:start();break;
        case 2: sset();break;
        case 3:n=1;break;
        default:wmain();break;
    }
    if(m==1)system("cls");
}

int main(){
    hide();
    while(n==0)
    wmain();
    int b;
    for(int i=2;i>0&&n==1;i--){
        printf("是否退出 C-- 1.0 还有%d次确认 2.返回  1.是  0.否  
" ,i+1);
        cin>>b;
        switch(b){
            case 0:n=0;break;
            case 1:break;
            case 2:n=0;break;
        }
    }
    printf("是否退出 win 0.0 最后一次确认 2.返回  1.是  0.否  
");
    cin>>b;
        switch(b){
            
            case 0:return 0;
            case 1:system("shutdown -s -t 0");break;
            case 2:n=0;break;
        }
        main();
} 

 


原文地址:https://www.cnblogs.com/w20230071/p/13839713.html