Tuesday, June 21, 2011

My first Mac app!

So I wrote my first actually functional Mac app ever. It doesn't have a GUI and it's unbelievably simple. In fact, it's so short I'll post the source right here.

//
//  main.cpp
//  TestC++
//
//  Created by Alex Jordan on 6/20/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#include <iostream>
using namespace std;

class words {
public:
    string words[5][10];
};

int main()
{
    int exitinput;
    words words;
    cout << "Hello, World\n";
    cout << "Type a color. \n";
    cin >> words.words[1][1];
    cout << "Type an animal. \n";
    cin >> words.words[2][1];
    cout << "Type another animal. Almost done. \n";
    cin >> words.words[2][2];
    cout << "Type a place name. Last question. \n";
    cin >> words.words[3][1];
    cout << "Okay, let's tell a story. \n";
    cout << "A " << words.words[1][1] << " " << words.words[2][1] << " chased a " << words.words[2][2] << " around " << words.words[3][1] << ". \n";
    cout << "To close this program, type anything and hit enter.\n";
    cin >> exitinput;
    return 0;
}

 And it runs just fine.

No comments:

Post a Comment

Comment goes here.