What I've been up to
I've had to go back to basics this week, reading tutorials on C++ and Java and stuff, seeing as I've resigned from my current job. I realised that I've put down these skills on my cv but couldn't write 10 lines of code off the top of my head. On sato evening, I attempted to create a console application in Visual C++, and couldn't remember how to add a c++ source file to the project. That was truly scary. After I clicked around and found a menu item to do this, I attempted to write a hello world program. Again I say attempted because the 6 lines of code generated 4 compile errors.
#include <iostream>
int main()
{
cout<<"hello world";
return 0;
}
I was horified!
Fortunately, things have been getting gradually better, but last night as I was reading one of my all time favourite c++ tutorials [which I'd stripped of course], I came to the point in the tutorial with the following code example
// increaser
#include <iostream>
using namespace std;
void increase (void* data, int size)
{
switch (size)
{
case sizeof(char) : (*((char*)data))++; break;
case sizeof(int) : (*((int*)data))++; break;
}
}
int main ()
{
char a = 'x';
int b = 1602;
increase (&a,sizeof(a));
increase (&b,sizeof(b));
cout << a << ", " << b << endl;
return 0;
}
I made a valiant effor to finish reading that page, onto the small matter of function pointers, and immediately shut down the machine.
0 Comments:
Post a Comment
<< Home