Tweets for 2008-02-10
- Scrabble time. #
- Big brain headache from too much coffee and too much trying to learn C++ in longhand. #
- jaw ear pain. Dizzy. Time to go grocery shopping. Whee… #
Powered by Twitter Tools.
Archive for February 10th, 2008
Powered by Twitter Tools.
I’m working on my second C++ program. Baby steps here, as I am merely trying to implement a simple and dirty sort.This morning I wrote this out in longhand, and I haven’t debugged it or tried compiling it.
#include <iostream>
namespace std;
int sort[] = [10, 2, 8, 4, 6, 0];
int i, x, y, z;
int main() {
for (i=0; i < sizeof(sort) ; i++) { // I don’t know how “sizeof” works so….
if (sort[i] > sort[i+1]) { // Do I need to init (aka set to zero) my var holders for each cycle?
x=sort[i+1];
y=sort[i];
sort[i]=x;
sort[i+1]=y;
z=1; // Set if change is made
}
}
if (z) { // if change is made, run sorting cycle all over again
// I haven’t worked out the code for this one yet
}
for (i=0; i < sizeof(sort) ;i++)> // so this should go display the sorted information
std::cout << sort[i];
}
std::endl;
return = 0;
}
elegiac has previously suggested that I start out going straight to a template implementation – I just haven’t looked into it far enough to even rough draft anything. Now I needed to get this on my programming computer and see just how bad my code really is. Eeek.
Powered by Twitter Tools