Within the next few months, I'll be changing careers. I'll be going from part-time programmer/writer to PR professional. I'm excited and nervous. But mostly excited.
I'm getting ready for this job by researching. I've been looking for good PR blogs to read all while studying how to write press releases. I really have no idea what I'm doing, but I figure I'll wing it until I do (or until someone catches on.)
It should be fun!
Feb 9, 2010
Dec 9, 2009
Programming Challenge: Hotel Occupancy
To keep my programming skills sharp, I’m going through my C++ programming book and trying random program challenges. You can do the same if you have the book, too. This is from Tony Gaddis’ Starting Out with C++ (5th Ed.) – you can purchase the book through Amazon or Half.com for a few dollars. I think I paid $20 for mine.
The challenge, Hotel Occupancy, is a multi-fold program that asks you to find out how many floors, rooms, and occupied rooms are in a hotel. Here are the exact instructions (if you have the book, it is challenge 9 on page 294):
However, there is a small caveat:
Hmm. Could be interesting! But look, there’s more:
Sounds like a lot of work, doesn’t it? Well, if you take it step by step, it’ll be easy to stay on track and keep everything in order.
(Again, I’m assuming you know how the correct template setup for a C++ program. I’m also assuming you know the basics of loops, too. If not, don’t freak out – I’ll write a small tutorial after this.)
Let’s begin!
Your user is going to input the number of floors of the hotel. That means you’re going to need to name a variable. I like to keep my code simple and easy to follow so I named my first variable (and integer) “floors.” Make sure you set the integer variable “floors” to 0 before you begin, so we know the integer is clear.
So, what would this code look like so far?
That wasn’t that bad. As soon as the user enters the number of floors, they’re going to enter the number of rooms on that floor and then the total occupied rooms on that floor.
The first part of the loop is starting it. Without going into too much technical mumbo jumbo, I need to come up with a variable for the loop (called a “loop counter variable”) that differs from the variable “floors,” since I, the programmer, do not know how many floors the user is going to enter. I’m going to call my loop counter variable something easy to recognize, like “loop_floors”. The loop will look like this:
Again, in layman’s terms: for each floor number, the program is going to ask the user how many rooms and how many occupied. (Make sure you add num_rooms_per_floor and num_occ_per_floor to your local declarations at the beginning of the program – remember, they’re integers too.)
I’m sure everyone’s excited about what comes next. It’s math time!
There are four things you have to find out:
1. The total number of rooms in the hotel.
2. The total number of unoccupied rooms per floor.
3. The total number of occupied rooms in the hotel.
4. The total number of unoccupied rooms in the hotel.
You’re going to need a couple more integer variables. Don’t forget to add them to your local declarations. Your equations look like this:
Like I said, this isn’t that difficult. I added in the comments for myself to keep track of what each equation did, but they’re for your benefit too. I also kept the variable names as obvious as I could – all are descriptive in name to help me keep track of what I have. Because these four equations are in the loop, it will keep a running total of how many rooms the user enters.
But guess what? We’re done with the loop! We can now safely end the loop and move on to the next part.
Here’s what our whole loop looks like:
Let’s get our output out of the way, first:
The challenge, Hotel Occupancy, is a multi-fold program that asks you to find out how many floors, rooms, and occupied rooms are in a hotel. Here are the exact instructions (if you have the book, it is challenge 9 on page 294):
“Write a program that calculates the occupancy rate for a hotel. The program should start by asking the user how many floors the hotel has. A loop should then iterate once for each floor. In each iteration, the loop should ask the user for the number of rooms on the floor and how many of them are occupied. After all the iterations, the program should display how many rooms the hotel has, how many of them are occupied, how many are unoccupied, and the percentage of rooms that are occupied. The percentage may be calculated by dividing the number of rooms occupied by the number of rooms.”
However, there is a small caveat:
“It is traditional that most hotels do not have a thirteenth floor. The loop in this program should skip the entire thirteenth iteration.”
Hmm. Could be interesting! But look, there’s more:
“Input Validation: Do not accept a value less than 1 for the number of floors. Do not accept a number less than 10 for the number of rooms on a floor.”
Sounds like a lot of work, doesn’t it? Well, if you take it step by step, it’ll be easy to stay on track and keep everything in order.
(Again, I’m assuming you know how the correct template setup for a C++ program. I’m also assuming you know the basics of loops, too. If not, don’t freak out – I’ll write a small tutorial after this.)
Let’s begin!
1. Variables
First thing’s first, the program has to ask the user how many floors the hotel has. Later on, we’ll figure out how make sure the user doesn’t enter 0 as the number of floors. But for now, let’s just ask the question.Your user is going to input the number of floors of the hotel. That means you’re going to need to name a variable. I like to keep my code simple and easy to follow so I named my first variable (and integer) “floors.” Make sure you set the integer variable “floors” to 0 before you begin, so we know the integer is clear.
So, what would this code look like so far?
int floors = 0; cout << "How many floors does this hotel have? "; cin >> floors;
That wasn’t that bad. As soon as the user enters the number of floors, they’re going to enter the number of rooms on that floor and then the total occupied rooms on that floor.
2a. Code the Loop – No Math
You’re going to need a loop. There are three types of loops you can use: while, do/while, and for. I’m going to use a for loop – it’s easiest in this situation. Later on I’ll go over the different kinds of loops and when to use either, but for now just concentrate on the task at hand.The first part of the loop is starting it. Without going into too much technical mumbo jumbo, I need to come up with a variable for the loop (called a “loop counter variable”) that differs from the variable “floors,” since I, the programmer, do not know how many floors the user is going to enter. I’m going to call my loop counter variable something easy to recognize, like “loop_floors”. The loop will look like this:
for (int loop_floors = 1; loop_floors <= floors; loop_floors++)What does this mean in layman’s terms? I assigned my loop counter variable a type and set it equal to 1 (int loop_floors = 1;), since we’ll be starting off with the first floor. If I set it equal to 0, we would be starting off on floor 0 – and there is no such thing! By doing this, I initialized the loop. The loop counter variable will always be less than or equal to the number of floors that the user enters (loop_floors <= floors;). This is called testing the loop. Finally, as long as the test holds true, the loop counter will increase by one each time (loop_floors++). This is called modifying the loop. Remember: do NOT include a semicolon after the loop modification. Your code will not compile. The second part of the loop is figuring out how many rooms are on each floor and of those rooms, how many of them are occupied. It looks like we’re going to need two more variables.
cout << "\nHow many rooms on floor " << loop_floors << "? "; cin >> num_rooms_per_floor; cout << "\nHow many rooms on floor "<< loop_floors << " are occupied? "; cin >> num_occ_per_floor;
Again, in layman’s terms: for each floor number, the program is going to ask the user how many rooms and how many occupied. (Make sure you add num_rooms_per_floor and num_occ_per_floor to your local declarations at the beginning of the program – remember, they’re integers too.)
I’m sure everyone’s excited about what comes next. It’s math time!
2b. Coding the Loop – The Math
Actually, the math portion of the loop is pretty simple since the program will be doing it all for you.There are four things you have to find out:
1. The total number of rooms in the hotel.
2. The total number of unoccupied rooms per floor.
3. The total number of occupied rooms in the hotel.
4. The total number of unoccupied rooms in the hotel.
You’re going to need a couple more integer variables. Don’t forget to add them to your local declarations. Your equations look like this:
total_hotel_rooms = total_hotel_rooms + num_rooms_per_floor; // Finds the total number of rooms. num_unocc_per_floor = num_rooms_per_floor - num_occ_per_floor; // Finds the total number of unoccupied rooms/floor. total_occ_hotel_rooms = total_occ_hotel_rooms + num_occ_per_floor; // Finds the total number of occupied hotel rooms. total_unocc_hotel_rooms = total_unocc_hotel_rooms + num_unocc_per_floor; // Finds the total number of unoccupied rooms.
Like I said, this isn’t that difficult. I added in the comments for myself to keep track of what each equation did, but they’re for your benefit too. I also kept the variable names as obvious as I could – all are descriptive in name to help me keep track of what I have. Because these four equations are in the loop, it will keep a running total of how many rooms the user enters.
But guess what? We’re done with the loop! We can now safely end the loop and move on to the next part.
Here’s what our whole loop looks like:
for (int loop_floors = 1; loop_floors <= floors; loop_floors++)
{
cout << "\nHow many rooms on floor " << loop_floors << "? ";
cin >> num_rooms_per_floor;
cout << "\nHow many rooms on floor "<< loop_floors << " are occupied? ";
cin >> num_occ_per_floor;
total_hotel_rooms = total_hotel_rooms + num_rooms_per_floor; // Finds the total number of rooms.
num_unocc_per_floor = num_rooms_per_floor - num_occ_per_floor; // Finds the total number of unoccupied rooms/floor.
total_occ_hotel_rooms = total_occ_hotel_rooms + num_occ_per_floor; // Finds the total number of occupied hotel rooms.
total_unocc_hotel_rooms = total_unocc_hotel_rooms + num_unocc_per_floor; // Finds the total number of unoccupied rooms.
}
3. Working Outside the Loop
Now that we’re done with our loop, we’re left with two more things: first, the program has to tell the user the room totals that our math just figured out; second, we have to find what percentage of the hotel is occupied. There’s more math involved, but again the program does it for us. We just have to figure out an equation.Let’s get our output out of the way, first:
cout << "\nThere are " << total_hotel_rooms << " total hotel rooms, with " << total_occ_hotel_rooms << " rooms occupied and "; cout << total_unocc_hotel_rooms << " rooms unoccupied." << endl;I spread it out over two couts because I can’t stand my code going over. Now, we have to figure out the percentage of occupied hotel rooms in the hotel. To find this, we divide the total number of occupied hotel rooms by the total number of hotel rooms. Then, we multiply it by 100:
percent_occ = (total_occ_hotel_rooms / total_hotel_rooms) * 100;Notice that I’m now using another variable. However, percent_occ is NOT an integer. Because I want a decimal answer, I’m going to want my new variable to be a real number. In my local declarations, I assigned it the “double” type. (There isn’t any particular reason why I didn’t call my real number variable “float” – I just used “double” because it was the first real number variable assignment I thought of. Feel free to use “float” if you wish.) Wait a second! What’s wrong with this picture? Well, if you were to run this program right now, your percent_occ would turn out to be an integer, since the total_occ_hotel_rooms and total_hotel_rooms are both integers and by default C++ will display an integer, not a real number. We’re going to have to manually change one of the variables into a real number without affecting the local declaration. This is what static-casting is for. It takes one variable and temporarily changes its assignment. Now our new equation is this:
percent_occ = (static_castDon’t forget to include an output statement telling the user what he/she is seeing:(total_occ_hotel_rooms) / total_hotel_rooms) * 100;
cout << percent_occ << " percent of the hotel is occupied." << endl;Hey, guess what? You have the makings of a great program here! We have more to do, but you have the basics covered. Let’s move on to the caveats…
4. The Caveats
Our program insists that “…this program should skip the entire thirteenth iteration.” This sounds SO much harder than it is. All that it takes is a single command. Go back to the very beginning of the loop and add this line:if (loop_floors == 13)
continue;
And that’s it! That’s all that it takes! When the loop variable counter gets to 13, it skips right over it and moves to 14. So easy, a caveman could do it.
The program also instructs us “not [to] accept a value less than 1 for the number of floors.” We’ll need to use and if/else structure. We’re going to specify that IF the user enters a number greater than 1, we’ll go through the loop. If the user enters anything lower than that, say a 0 or a –1, then the program will do something else, like tell the user to restart the program and enter a valid number.
Like this:
if (floors >=1)
{
for (int loop_floors = 1; loop_floors <= floors; loop_floors++)
{ // The rest of the loop goes here.
}
}
else
{
cout << "\nThe hotel should have more than one floor.";
cout << "\nPlease run the program again.\n";
}
Remember, your WHOLE LOOP goes after the if () statement. Meaning, if and only if the user enters a valid floor number will the loop execute.
For our final caveat, our instructions say, “Do not accept a number less than 10 for the number of rooms on a floor.” Again, another if statement is in order. This time, it’ll be in the loop, after the program asks the user how many rooms are on each floor. If the user enters anything lower than ten, we want to give an output statement. We also don’t want to continue with the rest of the loop, either. So how do we go about doing this?
May I present, the break; command:
if (num_rooms_per_floor < 10)
{
cout << "The hotel needs more than 10 rooms per floor.\n";
break;
}
Be very careful with breaking out of loops. If you don’t know what you’re doing, you could seriously mess up your loop. They’re necessary in this case, but always use caution when using them.
With break; in place, the program will break out of the loop and go to the next thing. In our case, it will go immediately to stating the totals AND the percentage. Since the user didn’t get to the math of the loop that figured that all out, we want to put the output/percent math into another if/else statement:
if (num_rooms_per_floor >= 10)
{
cout << "\nThere are " << total_hotel_rooms << " total hotel rooms, with " << total_occ_hotel_rooms << " rooms occupied and ";
cout << total_unocc_hotel_rooms << " rooms unoccupied." << endl;
percent_occ = (static_cast(total_occ_hotel_rooms) / total_hotel_rooms) * 100;
cout << percent_occ << " percent of the hotel is occupied." << endl;
}
That’s the end of our caveats, but that’s not the end of our coding.
5. Final Touches
This dawned on me while I was putting the finishing touches on the program. What if the user enters a larger number of occupied rooms than actual rooms? You can’t have that happening. Looks like a job for yet another if () statement.if (num_occ_per_floor > num_rooms_per_floor)
{
cout << "You cannot have more occupied rooms than rooms.\n";
break;
}
Again, you need to break out of the loop if the user enters an invalid amount. Then, you need to modify your statements out of the loop as well. Your if () statements with the final output and percentage will now look like this:
if (num_occ_per_floor <= num_rooms_per_floor && num_rooms_per_floor >= 10)
{
cout << "\nThere are " << total_hotel_rooms << " total hotel rooms, with " << total_occ_hotel_rooms << " rooms occupied and ";
cout << total_unocc_hotel_rooms << " rooms unoccupied." << endl;
percent_occ = (static_cast(total_occ_hotel_rooms) / total_hotel_rooms) * 100;
cout << percent_occ << " percent of the hotel is occupied." << endl;
}
And guess what ladies and/or gentlemen? You’ve finished your code!
The Finished Product
If you want to see what the final product could look like, take a look:
// This program calculates the occupancy for a hotel. // It asks the user how many floors the hotel has. // A loop will iterate once for each floor. // In each interation, the loop will ask the user for // the number of rooms on the floor and how many of them are occupied. // After all the iterations, the program should display how many // rooms the hotel has, how many of them are occupied, how many // are UNoccupied, and the percentage of rooms that are occupied. // The percentage is calculated by dividing the number of rooms // occupied by the number of rooms. #includeEnjoy.using namespace std; int main() { int floors = 0, num_rooms_per_floor = 0, num_occ_per_floor = 0, num_unocc_per_floor = 0, total_hotel_rooms = 0, total_occ_hotel_rooms = 0, total_unocc_hotel_rooms = 0; double percent_occ = 0.0; cout << "How many floors does this hotel have? "; cin >> floors; if (floors >= 1) { for (int loop_floors = 1; loop_floors <= floors; loop_floors++) { if (loop_floors == 13) continue; cout << "\nHow many rooms on floor " << loop_floors << "? "; cin >> num_rooms_per_floor; if (num_rooms_per_floor < 10) { cout << "The hotel needs more than 10 rooms per floor.\n"; break; } cout << "\nHow many rooms on floor "<< loop_floors << " are occupied? "; cin >> num_occ_per_floor; if (num_occ_per_floor > num_rooms_per_floor) { cout << "You cannot have more occupied rooms than rooms.\n"; break; } total_hotel_rooms = total_hotel_rooms + num_rooms_per_floor; // Finds the total number of rooms. num_unocc_per_floor = num_rooms_per_floor - num_occ_per_floor; // Finds the total number of unoccupied rooms/floor. total_occ_hotel_rooms = total_occ_hotel_rooms + num_occ_per_floor; // Finds the total number of occupied hotel rooms. total_unocc_hotel_rooms = total_unocc_hotel_rooms + num_unocc_per_floor; // Finds the total number of unoccupied rooms. } if (num_occ_per_floor <= num_rooms_per_floor && num_rooms_per_floor >= 10) { cout << "\nThere are " << total_hotel_rooms << " total hotel rooms, with " << total_occ_hotel_rooms << " rooms occupied and "; cout << total_unocc_hotel_rooms << " rooms unoccupied." << endl; percent_occ = (static_cast (total_occ_hotel_rooms) / total_hotel_rooms) * 100; cout << percent_occ << " percent of the hotel is occupied." << endl; } } else { cout << "\nThe hotel should have more than one floor."; cout << "\nPlease run the program again.\n"; } return 0; }
Nov 25, 2009
Simple Code: The Switch Statement
Ok. Class is finished. I'm happy to report that I know 100% more about coding now than I did months ago. To celebrate, I've decided that this blog needs a bit of a makeover. Instead of just being a blah-blah-blah internet blog (because there are NONE of those out there) or worse, a personal blog (again, none of them out there), I'm going to turn this blog into a coding repository. It's mostly for my benefit, but hopefully it will help other people who are interested in programming but don't know where to start.
Let's start off with a relatively simple program about apples, bananas, and the like.
Difficulty: Novice. At least know the basic structure of a C++ program and a good idea of how to use if/else if/else statements.
Part One: What's Your Favorite Fruit?
Who doesn't like fruit? I picked the first 6 fruit off the top of my head and put them into a small menu. It looks like this:
(I'm assuming you know this goes into int main(). If not, don't worry. I'll write another post explaining the very basics of C++ another time.)
Now that we have a menu with six random fruits to choose from, we need some ifs and else ifs and elses. Immediately after this menu, you need the following:
This is pretty easy to decipher. Begin with your first statement (always a plain 'ol
And that's it! It's not rocket science, folks; it's logic! =D
Part Two: Switchin' It Up
Not quite comfortable with if/else statements yet? That's ok. There is always the switch statement.
Use the same menu as you used in part one. But instead of the if/else statements, you're going to use the following format:
Three things to pay close attention to here: 1) The word "choice" in the parentheses after "switch" is the name of the variable. 2) The word "break" after each case means "don't do anything else for this condition." Do NOT forget it! 3) "Default" takes the place of the "else" statement. It means, "if the user doesn't enter numbers 1-6, the program will say this."
Part Three: Easy as A, B, C
Now, what if you don't want the user to enter numbers? What if you want them to enter letters instead? Guess what, you can do that too!
First and foremost, change your declaration int choice to char choice. Since we're no longer dealing with counting numbers, we can't define "choice" as an integer. It MUST be a character. Also, change your numbers in your menu to letters:
Wait a second! Notice how my letters are all capital letters? What if the user enters a lowercase letter instead? Will my program still work?
Don't worry, I gotcha covered:
I've made sure to include lowercase letters as well as the uppercase letters. (Remember, when characters are involved, always use single quotes!) Basically, I'm saying "If the user enters a lowercase letter OR if the users enters the same letter only in uppercase." It's just like coding:
And that's it! Wasn't that easy? Feel free to use and run this code and change it how you please to experiment with switch and if/else statements. I coded this with Microsoft Visual C++ 6.0, which is old but still works relatively well, but I'm sure it'll run in any IDE.
Let's start off with a relatively simple program about apples, bananas, and the like.
Difficulty: Novice. At least know the basic structure of a C++ program and a good idea of how to use if/else if/else statements.
Part One: What's Your Favorite Fruit?
Who doesn't like fruit? I picked the first 6 fruit off the top of my head and put them into a small menu. It looks like this:
int choice;
cout << "What is your favorite fruit?" << endl;
cout << "\n1. Apples" << endl;
cout << "2. Bananas" << endl;
cout << "3. Oranges" << endl;
cout << "4. Peaches" << endl;
cout << "5. Grapes" << endl;
cout << "6. Pears" << endl;
cout << "Enter your choice, 1-6: ";
cin >> choice;
(I'm assuming you know this goes into int main(). If not, don't worry. I'll write another post explaining the very basics of C++ another time.)
Now that we have a menu with six random fruits to choose from, we need some ifs and else ifs and elses. Immediately after this menu, you need the following:
if(choice == 1)
{
cout << "Your favorite fruit is apples!" << endl;
}
else if (choice == 2)
{
cout << "Your favorite fruit is bananas!" << endl;
}
else if (choice == 3)
{
cout << "Your favorite fruit is oranges!" << endl;
}
else if (choice == 4)
{
cout << "Your favorite fruit is peaches!" << endl;
}
else if (choice == 5)
{
cout << "Your favorite fruit is grapes!" << endl;
}
else if (choice == 6)
{
cout << "Your favorite fruit is pears!" << endl;
}
else
{
cout << "Please start over and pick a number, 1-6." << endl;
}
This is pretty easy to decipher. Begin with your first statement (always a plain 'ol
if) and give it a condition. IF the user chooses 1, then say, "Your favorite fruit is apples!". The rest of the conditions must have
else ifstatements. Finally, if the user does NOT choose 1-6, then they will get the
elsecondition.
And that's it! It's not rocket science, folks; it's logic! =D
Part Two: Switchin' It Up
Not quite comfortable with if/else statements yet? That's ok. There is always the switch statement.
Use the same menu as you used in part one. But instead of the if/else statements, you're going to use the following format:
switch (choice)
{
case 1 : cout << "Your favorite fruit is apples!" << endl;
break;
case 2 : cout << "Your favorite fruit is bananas!" << endl;
break;
case 3 : cout << "Your favorite fruit is oranges!" << endl;
break;
case 4 : cout << "Your favorite fruit is peaches!" << endl;
break;
case 5 : cout << "Your favorite fruit is grapes!" << endl;
break;
case 6 : cout << "Your favorite fruit is pears!" << endl;
break;
default : cout << "Please start over and pick a number, 1-6." << endl;
}
Three things to pay close attention to here: 1) The word "choice" in the parentheses after "switch" is the name of the variable. 2) The word "break" after each case means "don't do anything else for this condition." Do NOT forget it! 3) "Default" takes the place of the "else" statement. It means, "if the user doesn't enter numbers 1-6, the program will say this."
Part Three: Easy as A, B, C
Now, what if you don't want the user to enter numbers? What if you want them to enter letters instead? Guess what, you can do that too!
First and foremost, change your declaration int choice to char choice. Since we're no longer dealing with counting numbers, we can't define "choice" as an integer. It MUST be a character. Also, change your numbers in your menu to letters:
char choice;
cout << "What is your favorite fruit?" << endl;
cout << "\nA. Apples" << endl;
cout << "B. Bananas" << endl;
cout << "C. Oranges" << endl;
cout << "D. Peaches" << endl;
cout << "E. Grapes" << endl;
cout << "F. Pears" << endl;
cout << "Enter your choice, A-F: ";
cin >> choice;
Wait a second! Notice how my letters are all capital letters? What if the user enters a lowercase letter instead? Will my program still work?
Don't worry, I gotcha covered:
switch (choice)
{
case 'a' :
case 'A' : cout << "Your favorite fruit is apples!" << endl;
break;
case 'b' :
case 'B' : cout << "Your favorite fruit is bananas!" << endl;
break;
case 'c' :
case 'C' : cout << "Your favorite fruit is oranges!" << endl;
break;
case 'd' :
case 'D' : cout << "Your favorite fruit is peaches!" << endl;
break;
case 'e' :
case 'E' : cout << "Your favorite fruit is grapes!" << endl;
break;
case 'f' :
case 'F' : cout << "Your favorite fruit is pears!" << endl;
break;
default : cout << "Please start over and pick a letter, A-F." << endl;
}
I've made sure to include lowercase letters as well as the uppercase letters. (Remember, when characters are involved, always use single quotes!) Basically, I'm saying "If the user enters a lowercase letter OR if the users enters the same letter only in uppercase." It's just like coding:
if(choice == 'A' || choice == 'a')
And that's it! Wasn't that easy? Feel free to use and run this code and change it how you please to experiment with switch and if/else statements. I coded this with Microsoft Visual C++ 6.0, which is old but still works relatively well, but I'm sure it'll run in any IDE.
Sep 23, 2009
One Test Down...Many More to Go
I took my first C++ test on Monday and got the results back today: how does an 88 sound?
Pretty good for my first test. It was divided into three sections: multiple choice C++ trivia ("What is a character? What is a string? Which is the right syntax?"), math (I was told there would be none), and a program. I missed quite a few on the multiple choice section because I honestly don't remember definitions very well. I know that int main() is part of the program and I know where it goes in the program, but I have no idea what it's called. The math section was really tough since my teacher did not let us use calculators. Again, I don't think it is necessary to solve equations for C++ since, well, C++ is supposed to do it for you. But, at least I got the formulas right.
The program part is where I did the best. I missed ONE POINT on this section (something stupid), but I was so proud of myself. This is what REALLY counts. Can I write a program by hand with just an example user screen as my guide? I CAN. HURRAY!
Looks like I'll be a hell of a programmer after all.
Over the next few weeks, we'll be studying selection (if/else). I can't wait.
Pretty good for my first test. It was divided into three sections: multiple choice C++ trivia ("What is a character? What is a string? Which is the right syntax?"), math (I was told there would be none), and a program. I missed quite a few on the multiple choice section because I honestly don't remember definitions very well. I know that int main() is part of the program and I know where it goes in the program, but I have no idea what it's called. The math section was really tough since my teacher did not let us use calculators. Again, I don't think it is necessary to solve equations for C++ since, well, C++ is supposed to do it for you. But, at least I got the formulas right.
The program part is where I did the best. I missed ONE POINT on this section (something stupid), but I was so proud of myself. This is what REALLY counts. Can I write a program by hand with just an example user screen as my guide? I CAN. HURRAY!
Looks like I'll be a hell of a programmer after all.
Over the next few weeks, we'll be studying selection (if/else). I can't wait.
Aug 19, 2009
Fetch, Decode, Execute
So I've been taking a computer programming class and I'm excited. It's about damn time that I've stepped into programming. As my teacher said, once you learn one it's easier to pick up on another. I don't have any fear of this class -- I'm just excited to learn.
What are we learning? C++. It seems like the programming language that everyone starts out with. My younger sibling started out with C++ in high school. I hope to move on to languages like PHP and JavaScript eventually, but one thing at a time first. I'll be blogging more about it over the next few months.
So what have I learned so far? Lots, actually. I know 100% more about programming now than I did the day before I began this class. I've been picking up on it really well, too. Maybe I'm more left-brained than I thought. =P

What are we learning? C++. It seems like the programming language that everyone starts out with. My younger sibling started out with C++ in high school. I hope to move on to languages like PHP and JavaScript eventually, but one thing at a time first. I'll be blogging more about it over the next few months.
So what have I learned so far? Lots, actually. I know 100% more about programming now than I did the day before I began this class. I've been picking up on it really well, too. Maybe I'm more left-brained than I thought. =P

Aug 13, 2009
Poor Jaiku
Poor, poor Jaiku. What a neat little service it used to be! I used it all the time up until January. Now it's just a little shell of its former self: abandoned, discarded, rejected, etc. I logged in today to reminisce and now I'm just sad.
With the recent problems Twitter's been having - a whole morning down last Thursday due to a DDOS -- and then again on Tuesday, I've been looking for better a better microblogging service. I'm almost positive that I'm going to go with Identi.ca, but I wanted to look back at Jaiku just to see what was up.
Nothing was up. =(
With the recent problems Twitter's been having - a whole morning down last Thursday due to a DDOS -- and then again on Tuesday, I've been looking for better a better microblogging service. I'm almost positive that I'm going to go with Identi.ca, but I wanted to look back at Jaiku just to see what was up.
Nothing was up. =(
Jul 23, 2009
On Google Wave
If you're like me and you still haven't figured Google Wave out, here's a very helpful Mashable article that will explain in the way Google cannot. (That's BAD Google. If you can't adequately explain what your products do, how can you expect anyone to use it?)
Subscribe to:
Posts (Atom)


