glennlopez / cpp.playground Goto Github PK
View Code? Open in Web Editor NEW:octocat: educational repo for storing my practice sessions with ASM, C and C++ as well as solutions to online courses I take relating to ASM, C, and C++ programming
:octocat: educational repo for storing my practice sessions with ASM, C and C++ as well as solutions to online courses I take relating to ASM, C, and C++ programming
#include
using namespace std;
int main() {
int userNum1;
int userNum2;
userNum1 = 0;
userNum2 = 14;
if (userNum1 < 0) {
cout << "userNum1 is negative." << endl;
}
if (userNum2 <= 12) {
cout << "userNum2 is less than or equal to 12." << endl;
}
if (userNum2 > 12) {
userNum2 = 0;
}
else (userNum2 = userNum2);
cout << "userNum2 is " << userNum2 << endl;
return 0;
}
#include // for I/O
#include // for strlen()
#include // for random numbers
#include <unistd.h> // for sleep()
#include "ZyLab.h" // for ZyLab Setup
using namespace std;
int main(int argc, char **argv) {
const int DEFAULT_NUMBER_OF_ROUNDS = 15;
int numRounds = DEFAULT_NUMBER_OF_ROUNDS;
// if a command line argument is given, use that string to init the
// "random" sequence and set the number of rounds to play the game
if (argc == 2) {
numRounds = strlen(argv[1]);
}
string s; // A string used to pause the game
char c; // The player's typed characters
char *seq = new char[numRounds]; // Sequence of numRounds colors to match
char colors[] = "RGBY"; // Allowable colors
bool lost = false; // Indicates whether we win or lose
int round; // Indicates the current round
// Initialize random number generator
srand(time(0));
// Determine the random color sequence using either argv[1] or
// randomly determined letters from 'R', 'G', 'B', and 'Y'
for (int j = 0; j < numRounds; j++) {
seq[j] = (argc == 2) ? argv[1][j] : colors[rand() % 4];
}
// Wait until the player is ready
cout << "Welcome to Simon, press enter to play .... ";
getline(cin, s, '\n');
/* Type your code here. */
return 0;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.