This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This program demonstrates a destructor. | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
// Class specification | |
class Demo { | |
public: | |
Demo(); // Constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This program demonstrates a destructor. | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
// Class specification | |
class Demo { | |
public: | |
Demo(); // Constructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Program to demo an array of class objects | |
// Adapted from http://codeprecisely.blogspot.com/2011/09/program-to-demonstrates-array-of.html | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
class Book { | |
private: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void MainWindow::foo() { | |
qDebug() << "clicked the button"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This program demonstrates how to overload | |
// the post-increment operator | |
// https://gist.github.com/3399944 | |
#include <iostream> | |
#include <string> | |
using namespace std; | |
class Fraction { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ejemplo cout usando conditional assignment | |
#include <iostream> | |
using namespace std; | |
int main (void) { | |
int a = 35; | |
cout << "El numero es " << ((a % 2) ? "impar." : "par.") << endl; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Command line argument example #01 | |
#include <iostream> | |
using namespace std; | |
int main ( int argc, char *argv[] ) | |
{ | |
if ( argc < 2 ) { | |
cout<<"usage: "<< argv[0] <<" <your name>\n"; | |
exit(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Command line argument example #02 | |
#include <iostream> | |
using namespace std; | |
bool isNum(char *st) { | |
int i = 0; | |
while (st[i] != '\0') { | |
if (st[i] < '0' || st[i] > '9') return false; | |
i++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Command line argument example #03 | |
#include <iostream> | |
#include <fstream> | |
#include <cassert> | |
using namespace std; | |
int main ( int argc, char *argv[] ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// OJO: Este archivo contiene código que debe ser separado | |
// en los archivos: Rectangle.cpp, Rectangle.h, RectangleClient.cpp, | |
// y Makefile | |
//------ Rectangle.h file begins --------------------- | |
#include <iostream> | |
using namespace std; |
OlderNewer