Thursday, February 14, 2008

And she dreams about Programming!!!!

Well yesterday was pretty tiring and nothing much happened!!!

I realised one thing though:

There are two mindsets to adopt while programming:

1. Make the implementation of the solution so simple such that there are obviously no flaws
2. Make the implementation of the solution so complicated that the flaws are not obvious.

Some people are adopting the second mindset!!! How Sad ...... for me.....!!!

I cracked up when one of my students told me that she has been working so much on a labsheet that she has even dreamed of programming.... I dnt know how to interpret that. Well since she did not say that 'Programming gave her a nightmare..' I'll assume that you only dream about pleasant things. So I prefer to assume that she is enjoying programming!!!

Had only one lecture and that was tiring enough!!! And on top of that, met Tigrooooo!!! Hoo Hoo Hoo, who was in a bad shapes and it worries me coz the state she was in is really bad. I sincerely hope she get well soon and starts bouncing around.....
Please get better n come back, i have no one else to tease!!!:'-)

Take care of yourself Tigrooo! HOo HOo HOo!!!

Got home at about half past six and hey... I had my microwaved Nachos with Peri-Peri and Mozarella..... it did not taste as good without Jalepenos... But anyways!!! Was still better that nothing.

Then went for the usual MSN/Facebook Session....... nothing much apart from that!!!

I did try the returning array/strings thing and i came up with the following code and it worked fine on Visual C++

#include<iostream.h>
#include<string.h>
class tnt{
private:
int* a;
char Name[10];
public:
tnt();
int* getA();
void get_ary_A(int b[]);
void getName(char chr [10]);
char* getptrName();
};

tnt::tnt()
{
a=new int[5];
a[0]=56;
a[1]=2;
a[2]=8;
a[3]=9;
a[4]=14;

strcpy(Name,"Gavin");
}

int* tnt::getA()
{
return a;
}

void tnt::getName(char chr[])
{
strcpy(chr,Name);
}

char* tnt::getptrName()
{
return Name;/*return the string (pointer to char)*/
}

void tnt::get_ary_A(int b[])
{

for(int g=0;g<5;g++)
{
b[g] = a[g];
}
}

void main()
{
tnt channel;

int* A;
int B[5];

char gname[10], gname2[10];

channel.get_ary_A(B);
A=channel.getA();

channel.getName(gname);/*pass string to fn and it behaves as if its passed by ref*/
cout<<endl;
cout<<gname;
cout<<endl;

strcpy(gname2,channel.getptrName());/*returning the pointer to the array and copying result in a string*/
cout<<gname2;
cout<<endl;

cout<<"Using the pointer\n";
for(int i=0;i<5;i++)
{
cout<<A[i];
cout<<endl;
}

cout<<"Using an array passed by ref\n";
for(int j=0;j<5;j++)
{
cout<<B[j];
cout<<endl;
}

}//main


Have Fun!!

G@V!N

2 comments:

curiousEngine said...

Hello Sir.

I would like to firstly comment on dreaming about Programming. This anecdote might sound silly, but it really happened to me (just as Linux talked to me).

Well, I had to develop an information system for a client who urgently needed the product. Given that I wanted to increase my skills in VB.NET, I decided to develop it in VB/SQL. And the interesting stuff is that: one night after "hard core" session of coding, I shut down my PC to have a rest. Then after I closed my eyes, I dreamt about debugging the software. I said NO I am going mad!! I really switched on the PC, loaded the project in VS 2005 and found that YES, THERE WAS REALLY THE BUG THERE

***************************************
OK> Secondly, please edit this comment t remove the following part:
I have been trying to find your email add. but in vain. I wanted to request you, just as you have one student's blog in the blog roll, If you could kindly accept putting my blog in your LINKS TO MATES section. The following format would be OK:
Ashesh
Link: http://ashesh.ramjeeawon.info
my email is: ashesh@ramjeeawon.info

Finally, I find the maritop.net, your personal website badly needs to be maintained.

Thank you for removing the second part of the comment as from ********

G@V!N said...

If i remove it, that would be censoring what you said and i don't believe in that... :-) That's true that at times when you are have stopped working on something... then you get a solution... This is explained by the fact that your brain keeps on working even if your conscious mind is doing something else (including sleeping...).

Maritop.net... that's a long story... I use it to store stuff online (CVs, theses, notes and...)and to test websites, I agree that it is in acute need of maintenance, its been the case for more that 2 yrs now.... Just can't find enough time for it... But by the end of this semester, hopefully... i hope to completely revamp maritop.net to something decent... of a Computer Scientist who has studied Web-design and ...