Tuesday, June 20, 2006

C++ homework

to my friends in school, if you actually came to my blog, you're in for a treat. :D heres the answers for q3 :D (oh, and tag too while you're at it, just leave a message at the small blue box)

#include

using namespace std;

void main ( void )
{
char input[256];
int numAlp[26], i, j;

cout << "This program count the alphabets only..." <<>> input;

i = 0;

while ((int) input[i] != 0) {
i ++;
}

if (i > 20) {
cout << "Exceed limit!" << i =" 0;" i =" 0;"> 90) {
//generate index
j = (int) input[i] - 97;
//check for errors
if (j <= 26 || j >= 0) {
//j is valid, add it to the table
numAlp[j] = numAlp[j] + 1;
}
} else {
//upper case now
j = (int) input[i] - 65;
if (j <= 26 || j >= 0) {
//j is valid, add it to the table
numAlp[j] = numAlp[j] + 1;
}
}
}

cout << "Statistics:" << i =" 0;"> 0) {
cout << (char) (i + 97) << " = " << numAlp[i] << endl;
}
}

system ( "PAUSE" );
}

Bryan Dismas was shot at 7:07 PM

2 Comments:

Hello bryan.

My crazy first two months friend...

Remember me?

let's refresh your memory... we spent almost a whole afternoon decorating a window for valentine's that was kinda my idea. Kinda.

Hee.

Anyway, cool idea for a blog. ^^

By Anonymous Anonymous, at 8:59 PM  

err the code kinda mucked up. argh guess what isnt there :P

By Blogger Bryan Dismas, at 11:35 PM  

Post a Comment