Your review is Submitted Successfully. ×
Apr 29, 2003 05:31 PM, 1124 Views
(Updated Apr 29, 2003)
Programming isn't tough at all!!!

What comes into your mind when you think of’PROGRAMMING’-

  • Oh no! Maths again.

  • Need to have a good background in computers and who has time for that

  • Left to all Bill Gates kind of personalities -not our cup of tea. etc, etc, and the list goes on. Frankly speaking, any one having brains(among homosapiens) and capacity to think, can do programming.

SO, if this statement of mine lifted your spirits then please read further.


First and foremost, what is programming?


In simple terms, finding a solution for a given problem and making a computer(or any device) understand it thru instructions is nothing but programming.


In real life scenario, I can say that God has programmed all of us. He has programmed the babies to cry as soon as they come to this world. He has programmed children to be innocent. He has programmed girls(most of them.) to be naive, has programmed guys to be tough etc etc.Similarly, we(not computer geeks but anyone) can do programming. So, be prepared 10.9.8.3.2.1->here we go.(infact even this count-down can be programmed). Given


Problem: Need to know how many vowels are there in a given string.


Real life Analysis:


1)Just forget for sometime that you are a programmer, and think how will u solve this in real life scenario. Answer- Probably ask a person to write down his name or randomly select a word.


2)let the word be’education’.


Then either we can mentally calculate it or jot it down and keep a count of how many vowels we are encountering


.e.a vowel 1


.d not a vowel


.u.a vowel so 1+1=2


.c not a vowel and


so on and finally we get 5 as the answer.


easy isn’t it.now how do u tell a computer to do this.We know that’a, e, i, o, u’ are vowels but comp doesn’t know. WE know when the word has ended but the comp doesn’t. We can hear or see which word the person has said or written, but .


Well, here comes the solution.


Technical Analysis:


1)Accept the input from the user through the keyboard.


2)Initialize the counter to 0.


3)Read the first character of the accepted string.


4)Compare it with the set of vowels explicitly . If it is one of them then increase the counter else ignore and read the next character and continue doing this until you encounter a special character called end of file marker which is represented as’\n’.


5)Display the counter value. The above steps can be referred to as a pseudo-code or an algorithm.


Strictly speaking, the programming concept ends over here coz we know how to go about it.


After this comes pure coding which involves the knowledge of any of the basic languages or so. This one algorithm can be implemented in any of the languages. Its a misconception that we need to think differently while using different programming languages.


(Music is music.u need not know the language to understand it.most of the times).


Hence, one algorithm and many codes. There can be many solutions for a given problem. All of them may be right and works perfectly alright. Then how do you judge which algorithm is the best one.


Two factors- with respect to time and the memory usage. If this review has motivated even one of you to take up programming or atleast think about it, then I guess my efforts haven’t gone wasted.


Code in C language to check the character entered is a vowel or not -


main()


{ char ch;


printf(’Enter a character:’);


scanf(’%c’, &ch);


switch(ch)


{


case’a’:


case’e’:


case’i’:


case’o’:


case’u’:


printf(’Yes.its a vowel!’);


break;


default: printf(’Not a vowel.’);


}


}

(1)
Please fill in a comment to justify your rating for this review.
Post

Recommended Top Articles

Question & Answer