int main() { int x = 4; int siz; char buf[lol()] /*[lmao()]*/; char *p; strcpy(buf, "hello"); puts(buf); siz = sizeof buf; printf("vla size = %d\n", siz); strcpy(buf+2,"hm"); puts(buf); p = buf; if (p == buf) { puts("yes"); } p = buf + 1; if (--p == buf) { puts("yes"); } buf[1] = 'Y'; buf[0] = 'p'; puts(buf); x = buf[0]; buf[1] = x; puts(buf); }
int main() { ListQMark l; QMark lol(5); l.push_back(2.45); l.push_back("Hello"); l.push_back(100); l.get<int &>()++; try { std::cout << l.get<int>() << std::endl; std::cout << l.get<char const *>() << std::endl; std::cout << l.get<int>(1) << std::endl; } catch (std::exception &e) { std::cerr << e.what() << std::endl; } lol = "hello"; lol = 42.42; lol.as<double &>()++; ((double &)(lol))++; std::cout << lol << std::endl; const std::list<int> &in = l.sub<int>(); for (std::list<int>::const_iterator it = in.begin(); it != in.end(); it++) { std::cout << *it << std::endl; } }
void multiblock_1(int b, rmc_int *p, rmc_int *q) { VEDGE(ainner, post); VEDGE(a, b); LS(a, { L(ainner, lol()); if (b) { rmc_store(q, 1); } else { rmc_store(p, 1); } });
int main(void) { puts("going to read..."); lol(1000); puts("exiting...."); return 0; }
/* lol1 */ int main() { char*a="#include <stdio.h>%cvoid lol(){}%c/*%c%clol1%c*/%cint main()%c{%c%cchar*a=%c%s%c;%c%cprintf(a,10,10,10,9,10,10,10,10,9,34,a,34,10,9,10,9,10,9,10,9,9,10,9,10,10);%c%clol();%c%c/*%c%c%clol2%c%c*/%c}%c"; printf(a,10,10,10,9,10,10,10,10,9,34,a,34,10,9,10,9,10,9,10,9,9,10,9,10,10); lol(); /* lol2 */ }
int main (int argc, const char * argv[]) { int i; char temp[MAXSIZE+1]; temp[10] = '\0'; scanf("%d", &num); for (i = 1; i <= num; i++) { int c = 0; do { if (c > 1 && temp[c] == '\n') { temp[c] = '\0'; break; } temp[c] = getchar(); } while (temp[c] == ' ' || temp[c] == '\n' || temp[c] == '\r' || ++c < MAXSIZE); if (lol(temp, BLJTV1) == 0) { channel1 = i; } else if (lol(temp, BLJTV2) == 0){ channel2 = i; } } for (i = 1; i < channel1; i++) { printf(MOVEUP); } for (i = channel1; i > 1; i--) { printf(SWITCHDOWN); } if (channel2 < channel1) { channel2++; } for (i = 1; i < channel2; i++) { printf(MOVEUP); } for (i = channel2; i > 2; i--) { printf(SWITCHDOWN); } printf("\n"); return 0; }
void UDPLoopbackRunnable::run(int argc, char ** argv) { if (argc < 1) { std::cerr << "udp-loop was expecting at least 1 argument." << std::endl; return; } unsigned int port; std::string lol(argv[0]); std::stringstream ss(lol); ss >> port; UDPLoopbackServer server(port); }
int main() { CoffeeMachine lol(5, 5); lol.brew(); std::cout << lol.coffee << std::endl; std::cin.get(); std::cout << std::flush; return 0; }
bool join::validator(QString str) { QByteArray arr; arr.append("$check$"+str+"$"); socket->write(arr); socket->flush(); socket->waitForBytesWritten(); qDebug()<<"wrote"; QEventLoop loop; connect(socket,SIGNAL(readyRead()),&loop,SLOT(quit())); loop.exec(); qDebug()<<"pahunch gaya"; QByteArray a=socket->readAll(); QString lol(a); if(lol=="$nonvalidated$") {qDebug()<<false;return false;} if(lol=="$validated$") {qDebug()<<true;return true;} qDebug()<<false; return false; }
/* pretend we're doing a lot of things here */ void lol(int a) { char c2[256]; /* allocate lots of stack */ if (a == 0) foo(); else lol(a-1); }
int main() { std::cout << "############----EX00----###############" << std::endl; { { FragTrap f1; while (f1.hit_points() > 0) { f1.beRepaired(5); f1.takeDamage(25); f1.meleeAttack("Warior"); f1.rangedAttack("Robot"); f1.vaulthunter_dot_exe("Man"); std::cout << std::endl; std::cout << "Hit Points: " << f1.hit_points() << std::endl; } } std::cout << "_________________" << std::endl; { FragTrap f2("NOOD"); while (f2.hit_points() > 0) { f2.beRepaired(5); f2.takeDamage(35); f2.vaulthunter_dot_exe("Man"); std::cout << std::endl; std::cout << "Hit Points: " << f2.hit_points() << std::endl; } } } std::cout << "############----EX01----###############" << std::endl; { std::cout << "_______FR4G_______" << std::endl; { FragTrap f1; while (f1.hit_points() > 0) { f1.beRepaired(5); f1.takeDamage(25); f1.meleeAttack("Warior"); f1.rangedAttack("Robot"); f1.vaulthunter_dot_exe("Man"); std::cout << std::endl; std::cout << "Hit Points: " << f1.hit_points() << std::endl; } } std::cout << "_______SC4V_______" << std::endl; { ScavTrap s1("BOT"); while (s1.hit_points() > 0) { s1.beRepaired(5); s1.takeDamage(35); s1.challengeNewcomer("Woman"); std::cout << std::endl; std::cout << "Hit Points: " << s1.hit_points() << std::endl; } } } std::cout << "############----EX02----###############" << std::endl; { std::cout << "_______FR4G_______" << std::endl; FragTrap *f1 = new FragTrap("Yana"); while (f1->hit_points() > 0) { f1->beRepaired(5); f1->takeDamage(25); f1->meleeAttack("Warior"); f1->rangedAttack("Robot"); f1->vaulthunter_dot_exe("Man"); std::cout << std::endl; std::cout << "Hit Points: " << f1->hit_points() << std::endl; } delete f1; std::cout << "_______SC4V_______" << std::endl; ScavTrap *s1 = new ScavTrap("Paul"); while (s1->hit_points() > 0) { s1->beRepaired(5); s1->takeDamage(35); s1->challengeNewcomer("Woman"); std::cout << std::endl; std::cout << "Hit Points: " << s1->hit_points() << std::endl; } delete s1; } std::cout << std::endl << "############----EX03----###############" << std::endl << std::endl; { std::cout << "_______FR4G_______" << std::endl; FragTrap *f1 = new FragTrap("Robot"); std::cout << "_______SC4V_______" << std::endl; ScavTrap *s1 = new ScavTrap("Warior"); std::cout << "_______NINJA_______" << std::endl; NinjaTrap *n1 = new NinjaTrap("Boss"); n1->takeDamage(20); n1->beRepaired(10); n1->ninjaShoebox(*n1); n1->ninjaShoebox(*f1); n1->ninjaShoebox(*s1); std::cout << "_______NINJA_______" << std::endl; delete n1; std::cout << "_______SC4V_______" << std::endl; delete s1; std::cout << "_______FR4G_______" << std::endl; delete f1; } std::cout << std::endl << "############----EX04----###############" << std::endl << std::endl; { SuperTrap sc("sysy"); FragTrap lol("lol"); sc.rangedAttack("yany"); sc.meleeAttack("yany"); sc.vaulthunter_dot_exe("popol"); sc.ninjaShoebox(lol); std::cout << std::endl; std::cout << std::endl; std::cout << std::endl; } return 0; }
void MyGame::parse_menu() { if (this->state == PAUSE) { if (touch > 12 && touch < 17) { if (input_.isKeyDown(gdl::Keys::Escape) || (input_.isKeyDown(gdl::Keys::Space) && touch == 13)) { Vector3f t; t.x = 300 * this->map_size; t.y = 490 * this->map_size + 200; t.z = 285 * this->map_size; this->camera_.setPosition_(t); this->camera_.initialize(this->objects_, true); this->state = JEU; } else if (input_.isKeyDown(gdl::Keys::Up) || input_.isKeyDown(gdl::Keys::Down)) { if (input_.isKeyDown(gdl::Keys::Down)) touch++; else touch--; } else if (input_.isKeyDown(gdl::Keys::Space)) { if (touch == 16) { window_.close(); exit(0); } else if (touch == 15) touch = 18; } } else if (touch == 18) { if (input_.isKeyDown(gdl::Keys::Escape)) touch = 13; } } else if (touch == 100 || touch == 20) { if (touch == 20) { unsigned int x; std::map<int, bool> inp; std::map<int, bool>::const_iterator beg; x = 0; inp[0] = input_.isKeyDown(gdl::Keys::Numpad0); inp[1] = input_.isKeyDown(gdl::Keys::Numpad1); inp[2] = input_.isKeyDown(gdl::Keys::Numpad2); inp[3] = input_.isKeyDown(gdl::Keys::Numpad3); inp[4] = input_.isKeyDown(gdl::Keys::Numpad4); inp[5] = input_.isKeyDown(gdl::Keys::Numpad5); inp[6] = input_.isKeyDown(gdl::Keys::Numpad6); inp[7] = input_.isKeyDown(gdl::Keys::Numpad7); inp[8] = input_.isKeyDown(gdl::Keys::Numpad8); inp[9] = input_.isKeyDown(gdl::Keys::Numpad9); for (beg = inp.begin(); beg != inp.end(); beg++) { x++; if (beg->second == true) { if (map_unit != 0) { map_diz = map_unit; map_unit = x - 1; } else map_unit = x - 1; break; } } } if (touch == 20) { this->map_size = this->map_diz * 10 + this->map_unit; if (this->map_size > 10) this->map_size = 10; else if (this->map_size < 1) this->map_size = 1; Map lol(this->map_name[this->map_size - 1], this->camera_, this->texture_); this->objects_ = lol.generate(); this->map_size = 15; } else { this->map_size = this->map_diz * 10 + this->map_unit; Map lol(this->map_size, 5, this->camera_, this->texture_); this->objects_ = lol.generate(); } if (input_.isKeyDown(gdl::Keys::Escape)) touch = 1; else if (input_.isKeyDown(gdl::Keys::Space)) { Vector3f t; t.x = 300 * this->map_size; t.y = 490 * this->map_size + 200; t.z = 285 * this->map_size; this->camera_.setPosition_(t); if (touch == 20) this->camera_.initialize(this->objects_, true); else this->camera_.initialize(this->objects_, true); std::list<AObject*>::iterator itb = this->objects_->begin(); for (; itb != this->objects_->end(); ++itb) (*itb)->initialize(); this->state = JEU; } } else { if (input_.isKeyDown(gdl::Keys::Down)) touch++; else if (input_.isKeyDown(gdl::Keys::Up)) touch--; else { if (input_.isKeyDown(gdl::Keys::Escape)) { if (touch >= 1 && touch <= 6) { window_.close(); exit(0); } else if ((touch == 10) || (touch >= 20)) touch = touch % 10; } else { if (input_.isKeyDown(gdl::Keys::Space)) { if (touch == 6) { window_.close(); exit(0); } else if (touch < 12 && touch != 3) { if (touch == 1) this->players = 1; else this->players = 2; touch = touch * 10; } } else if (touch == 10) { unsigned int x; std::map<int, bool> inp; std::map<int, bool>::const_iterator beg; x = 0; inp[0] = input_.isKeyDown(gdl::Keys::Numpad0); inp[1] = input_.isKeyDown(gdl::Keys::Numpad1); inp[2] = input_.isKeyDown(gdl::Keys::Numpad2); inp[3] = input_.isKeyDown(gdl::Keys::Numpad3); inp[4] = input_.isKeyDown(gdl::Keys::Numpad4); inp[5] = input_.isKeyDown(gdl::Keys::Numpad5); inp[6] = input_.isKeyDown(gdl::Keys::Numpad6); inp[7] = input_.isKeyDown(gdl::Keys::Numpad7); inp[8] = input_.isKeyDown(gdl::Keys::Numpad8); inp[9] = input_.isKeyDown(gdl::Keys::Numpad9); for (beg = inp.begin(); beg != inp.end(); beg++) { x++; if (beg->second == true) { if (map_unit != 0) { map_diz = map_unit; map_unit = x - 1; } else map_unit = x - 1; break; } } } } } } if (touch == 0 || touch == 9 || touch == 12 || touch == 19 || touch == 29 || touch == 39 || touch == 49 || touch == 99) touch++; else if (touch == 7 || touch == 11 || touch == 17 || touch == 21 || touch == 31 || touch == 41 || touch == 51 || touch == 101) touch--; this->texture_[menuselect[touch -1]] = gdl::Image::load(menuselect[touch - 1]); }
int main(int argc, char const **argv) { ios_base::sync_with_stdio(false); if(argc<2) { cout << "Usage: CppToHTML [options] <file>" << endl; return 0; } string file_name; for(int i=1; i<argc; ++i) { if(argv[i][0]=='-' && argv[i][1]=='c') { string col_scheme(argv[i]+2); if(col_scheme.empty() && ++i<argc) col_scheme.assign(argv[i]); if(col_scheme=="sublime") color_scheme=sublime; else if(col_scheme=="codeblocks") color_scheme=codeblocks; else cout << "Undefined color scheme!\nColor schemes:\n sublime\n codeblocks" << endl; } else if(string(argv[i])=="--help") cout << "Usage: CppToHTML [options] <file>\nOptions:\n -c <color_scheme> Color schemes: sublime, codeblocks" << endl; else file_name=argv[i]; } if(file_name.empty()) { cout << "You must specify the file name!\nUsage: CppToHTML [options] <file>" << endl; return 0; } // make is_name array is_true_name[static_cast<unsigned char>('_')]=is_name[static_cast<unsigned char>('_')]=true; for(int i='A'; i<='Z'; ++i) is_true_name[i]=is_name[i]=true; for(int i='a'; i<='z'; ++i) is_true_name[i]=is_name[i]=true; for(int i='0'; i<='9'; ++i) is_true_name[i]=true; // get search includes directories and actual path - only for linux! // includes fstream settings("settings.cfg", ios_base::in); if(settings.good()) { string path; while(!settings.eof()) { getline(settings, path); parser::include_directories.push_back(path); } } else cerr << "Cannot load settings.cfg file with include directories!\n"; // path if(file_name[0]!='/') { system("pwd > lol.shell"); fstream lol("lol.shell", ios_base::in); string path; if(lol.good()) { getline(lol, path); lol.close(); } system("rm -f lol.shell"); if(*--path.end()!='/') path+='/'; file_name=path+file_name; } parser::init(); parser::parse_file(file_name); // ------------------ fstream file(file_name.c_str(), ios_base::in), output; if(!file.good()) cerr << "Cannot open file!" << endl; else { output.open((file_name+".html").c_str(), ios_base::out); string input, lol, efn=extract_file_name(file_name); int i=2; switch(color_scheme) { case sublime: output << "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Source code of "+efn+"</title>\n<style>\nbody{\n background: #272822;\n color: #f8f8f2;\n font-size: 14px;\n}\n.code_table{\n border-spacing: 0;\n display: inline-block;\n line-height: 18px;\n border: 2px solid #49483e;\n border-radius: 4px;\n}\n.code_table pre{\nfont-family: \"DejaVu Sans Mono\"\n}\n.code_table tbody tr td{\n padding: 0;\n}\n.cpp_code{\n text-align: left;\n margin: 0;\n padding: 5px 5px 5px 1em;\n}\n\n.num_lines{\n color: #8f908a;\n margin: 0;\n text-align: right;\n padding: 5px 4px 5px 4px;\n border-right: 2px solid #49483e;\n}\n.p1{color: #a6e22e;}\n.p2{color: #ff9b4b;}\n.p3{color: #f92672;}\n.p4{color: #66d9ef;font-style: italic;}\n.p41{color: #66d9ef;}\n.p42{color: #a6e22e;}\n.p5{color: #b15555;}\n.p6{color: #ae81ff;}\n.p7{color: #e6db74;}\n.p71{color: #e6db74;}\n.p8{color: #75715e;}\n.p9{color: #3c74ec;}\n</style>\n</head>\n<body>\n<table class=\"code_table\">\n<tbody>\n<tr>\n<td>\n<pre class=\"num_lines\">\n";break; case codeblocks: output << "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Source code of "+efn+"</title>\n<style>\nbody{\n background: #ffffff;\n color: #000000;\n font-size: 14px;\n}\n.code_table{\n border-spacing: 0;\n display: inline-block;\n line-height: 18px;\n border: 1px solid #afafaf;\n border-radius: 4px;\n}\n.code_table pre{\nfont-family: \"DejaVu Sans Mono\"\n}\n.code_table tbody tr td{\n padding: 0;\n}\n.cpp_code{\n text-align: left;\n margin: 0;\n padding: 5px 5px 5px 1em;\n}\n.num_lines{\n color: #4c4c4c;\n margin: 0;\n text-align: right;\n padding: 5px 4px 5px 4px;\n border-right: 1px solid #afafaf;\n}\n.p1{color: #00a000;}\n.p2{color: #e20deb;font-weight: bold;}\n.p3{color: #0000ff;font-weight: bold;}\n.p4{color: #0000ff;font-weight: bold;}\n.p41{color: #1c8ce5;font-weight: bold;}\n.p42{color: #e20deb;font-weight: bold;}\n.p5{color: #ff0000;}\n.p6{color: #f000f0;}\n.p7{color: #0000ff;}\n.p71{color: #e0a000;}\n.p8{color: #a0a0a0;}\n.p9{color: #00a000;font-weight: bold;}\n</style>\n</head>\n<body>\n<table class=\"code_table\">\n<tbody>\n<tr>\n<td>\n<pre class=\"num_lines\">\n";break; } if(!file.eof()) { getline(file, lol); // input+=lol (tab_size=4) for(int ll=lol.size(), q=0; q<ll; ++q) { if(lol[q]=='\t') input+=" "; else input+=lol[q]; } output << '1' << endl; } while(!file.eof()) { input+='\n'; getline(file, lol); // input+=lol (tab_size=4) for(int ll=lol.size(), q=0; q<ll; ++q) { if(lol[q]=='\t') input+=" "; // tab size: 4 else input+=lol[q]; } output << i << '\n'; ++i; } file.close(); output << "</pre>\n</td>\n<td>\n<pre class=\"cpp_code\">\n"; //cout << input << endl; output << synax_highlight::code_coloring(input) << endl; output << "</pre>\n</td>\n</tr>\n</tbody>\n</table>\n</body>\n</html>"; output.close(); compress(file_name+".html"); } return 0; }
void descreteft(const std::string& filename){ bool highpass = false; // A gray image cv::Mat_<float> img = cv::imread(filename, CV_LOAD_IMAGE_GRAYSCALE); //Pad the image with borders using copyMakeBorders. Use getOptimalDFTSize(A+B-1). See G&W page 251,252 and 263 and dft tutorial. (Typicly A+B-1 ~ 2A is used) int rows = cv::getOptimalDFTSize(2*img.rows); int cols = cv::getOptimalDFTSize(2*img.cols); int imgRows = img.rows; int imgCols = img.cols; cv::copyMakeBorder(img,img,0,rows-img.rows,0,cols-img.cols,cv::BORDER_CONSTANT,cv::Scalar(0)); //Copy the gray image into the first channel of a new 2-channel image of type Mat_<Vec2f>, e.g. using merge(), save it in img_dft //The second channel should be all zeros. cv::Mat_<float> imgs[] = {img.clone(), cv::Mat_<float>(img.rows, img.cols, 0.0f)}; cv::Mat_<cv::Vec2f> img_dft; cv::merge(imgs, 2, img_dft); // Compute DFT cv::dft(img_dft, img_dft); // Split cv::split(img_dft, imgs); // Compute magnitude/phase cv::Mat_<float> magnitude, phase; cv::cartToPolar(imgs[0], imgs[1], magnitude, phase); // Shift quadrants for viewability dftshift(magnitude); // Logarithm of magnitude cv::Mat_<float> magnitudel; // Output image for HPF cv::Mat_<float> imgout; if(highpass) { // High-pass filter: remove the low frequency parts in the middle of the spectrum const int sizef = 50; magnitude(cv::Rect(magnitude.cols/2-sizef/2, magnitude.rows/2-sizef/2, sizef, sizef)) = 0.0f; // Take logarithm of modified magnitude magnitudel = magnitude + 1.0f; cv::log(magnitudel, magnitudel); // Shift back quadrants of the spectrum dftshift(magnitude); // Compute complex DFT output from magnitude/phase cv::polarToCart(magnitude, phase, imgs[0], imgs[1]); // Merge DFT into one image and restore cv::merge(imgs, 2, img_dft); cv::dft(img_dft, imgout, cv::DFT_INVERSE + cv::DFT_SCALE + cv::DFT_REAL_OUTPUT); //Cut away the borders imgout = imgout(cv::Rect(0,0,imgCols,imgRows)); } else { // Take logarithm of magnitude magnitudel = magnitude + 1.0f; cv::log(magnitudel, magnitudel); } // Show cv::normalize(img, img, 0.0, 1.0, CV_MINMAX); cv::normalize(magnitudel, magnitudel, 0.0, 1.0, CV_MINMAX); cv::normalize(phase, phase, 0.0, 1.0, CV_MINMAX); cv::imshow("Input", img); cv::imshow("Magnitude", magnitudel); if(highpass) { cv::normalize(imgout, imgout, 0.0, 1.0, CV_MINMAX); cv::imshow("Output", imgout); } cv::Mat lol(cv::Size(magnitudel.cols,magnitudel.rows),CV_8UC1); for(int i = 0;i<magnitudel.rows;i++){ for(int j = 0;j<magnitudel.cols;j++){ lol.at<char>(i,j) = magnitudel.at<float>(i,j)*255; } } cv::imwrite("../ImagesForStudents/Magnitude.png", lol); cv::waitKey(); }