#Compilng You need g++ 4.9 to compile this code. Follow these steps to install g++-4.9
After installing run the following command to compile
/usr/bin/g++-4.9 -std=c++11 lambda.cpp
#Running
./a.out
| +++++ +++++ ++ > ++++ < [->[->+>+<<]>>[-<<+>>]<<<]>>. |
| //This uses requirejs style definition | |
| //require this file as a class and extend to make a collection view | |
| define( | |
| function(){ | |
| //This is a generic collection view, | |
| //overwrite as you see fit | |
| //viewOptions, ModelView, template should all change | |
| return Backbone.View.extend({ | |
| startListeners : function(){ |
| var mongoose = require('mongoose'); | |
| var db = mongoose.connection; | |
| db.on('error', console.error); | |
| db.once('open', function(){ | |
| var studSchema = new mongoose.Schema({ | |
| name: String | |
| }, { strict: false }); | |
| var Student = mongoose.model('Student', studSchema, 'student'); |
| var mongoose = require('mongoose'); | |
| mongoose.connect('mongodb://localhost/generic'); | |
| var genericSchema = new mongoose.Schema({}, { strict: false }); | |
| var createDoc = function(document, collection, callback){ | |
| var Model = mongoose.model('Model', genericSchema, collection); | |
| Model.create(document, function(err, document){ | |
| if(!err){ | |
| callback(document); |
| var mongoose = require('mongoose'); | |
| mongoose.connect('mongodb://localhost/schematest'); | |
| var animalSchema = new mongoose.Schema({ | |
| type: {type: String, required: true}, | |
| age: Number, | |
| lastInspected: {type: Date, default: Date.now}, | |
| name: {type: String, required: false} | |
| }); |
| var mongoose = require('mongoose') | |
| , Schema = mongoose.Schema | |
| var personSchema = Schema({ | |
| _id : Number, | |
| name : String, | |
| age : Number, | |
| stories : [{ type: Schema.Types.ObjectId, ref: 'Story' }] | |
| }); |
#Compilng You need g++ 4.9 to compile this code. Follow these steps to install g++-4.9
After installing run the following command to compile
/usr/bin/g++-4.9 -std=c++11 lambda.cpp
#Running
./a.out
| #include<iostream> | |
| using namespace std; | |
| string prompt_user(string input_prompt){ | |
| string reply; | |
| cout << input_prompt << endl; | |
| cin >> reply; //only use one of these two lines. | |
| //getline(cin, reply); | |
| return reply; | |
| }; |
| #include<iostream> | |
| std::string prompt_user(std::string input_prompt){ | |
| std::string reply; | |
| std::cout << input_prompt << std::endl; | |
| //std::getline(std::cin, reply); | |
| std::cin >> reply; | |
| return reply; | |
| }; |
| x = 2 * (4 + 12) | |
| y = x + 8 | |
| z = y * y | |
| w = "hi" | |
| u = w * 3 | |
| print(x,y,z,w,u) |