这几天在反复琢磨饼干的代码,试着写了一个“低配高级”版(其实就是没饼干的厉害),还设计了一个logo(logo其实还是彩虹猫)。
#include<bits/stdc++.h> #include "stdio.h" #include "windows.h" using namespace std; string str(string n) { n = "start " + n; return n; } void ydgb(int x, int y) { COORD pos = { x,y }; HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hOut, pos); } int main() { system("mode con cols=60 lines=30"); for(int i=1;; i++) { SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY); cout<<" ## ##"<<endl; cout<<" # # # #"<<endl; cout<<" # # # # # # "<<endl; cout<<" # #"<<endl; cout<<" # "; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); cout<<"# # "; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY); cout<<"#"<<endl; cout<<" # # "<<endl; cout<<" # "; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); cout<<"|__|__| "; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY); cout<<"#"<<endl; cout<<" # # # # # # #"<<endl; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_BLUE); for(int i=1; i<=10; i++) cout<<" "; for(int i=1; i<=40; i++) cout<<"-"; cout<<endl; for(int i=1; i<=10; i++) cout<<" "; cout<<"|"; for(int i=1; i<=23; i++) cout<<" "; cout<<"按Enter打开网页"; cout<<"|"<<endl; for(int i=1; i<=10; i++) cout<<" "; for(int i=1; i<=40; i++) cout<<"-"; string n; SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE); ydgb(11,9); cin>>n; n=str(n); system(&n[0]); system("cls"); } }
如果有什么建议的话,还请多多指教!!!