Thread: Guess What...??

  1. #16
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Dumb luck?

  2. #17
    Registered User
    Join Date
    Apr 2011
    Location
    Karachi, Pakistan
    Posts
    19
    @ CommonTater



    Not the luck....this is a very lowly suggestion by you whom I believe to be a very proficient C programmer....
    Luck....easy explaination of complexities eh...?
    Better say nothing...

    You badger me very forcefully that I'm using a "useless" compiler nd it is inevitable for me to change it now. For one thing, I'm in no position of changing my course instructor's mind who has his reason for teaching me programming principles through Turbo 'c'. You know my course focuses on programming principles basically and not the programming techniques or its formating style, and Turbo C is quite appropriate for learning basic principles and subsequent higher programming skills.

    Besides, I'm doing B.S. in Applied Physics so my main field is Physics. Turbo C is only a subsidiary course in which we are taught how to programme many electronic devices such as PLC's (Programmable logic controller). Thank u for your referrences to modern compilers, that was good to know about them. But no Thanks.

  3. #18
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Your instructor is STILL teaching Turbo C? Whew... I'd be looking for a new school at that rate.

    This is no joke and I'm not badgering you... I'm trying to get you to understand that the overall programming paradigm has changed so profoundly since that was "the new best thing" that what you learn on Turbo C won't even translate to a modern 32 or 64 bit compiler... Sure some of it's the same, but most of it isn't. The skills you acqurie working with something of that age won't even get you a job interview...

    But it's up to you... if you wan't to self-sabotage before you even get a chance, there's very little I can do about it.

  4. #19
    Registered User
    Join Date
    Apr 2011
    Location
    Karachi, Pakistan
    Posts
    19
    Yes whatever.....one thing I'd like to clarify is that principles NEVER change however moderen you may become.....The principles of "sequencing instructions" on the punched cards laid down by Hon. Lady Ada Lovelace <http://en.wikipedia.org/wiki/Ada_Lovelace> are the very same which are still in vogue for creating Algorithms, however we've now shifted from the use of punched cards....this is what's happening...same underlying principles; many-faceted technologies.
    Apart from that, u remembr the Y2K horror<http://en.wikipedia.org/wiki/Y2K>...it happend because the programmers didn't expect their programmes to be still in use after 1 or 2 decades therefore they set the dates with only the last two digits (which cost them fairly high! just read on)...
    Actually programmers overlooked the importance of the purpose of their programmes and only considered the speedy innovations in this field. They, inadvertently, forgot that the innovations may serve the purpose but never overtake its importance entirely. And sorrily, that's what you are doing.
    Turbo C might not be very compatible with its brother compilers, but it still offers the easy learning of founding programming skills. You know after learning C++ on the same compiler, we'd be expert enough to start working on JAVA which is our next course....

    Good Day!

    SLYTHERIN

    "Innovations may seve the purpose but never overtake its importace entirley."
    Lord Slytherin
    Last edited by Lord Slytherin; 04-27-2011 at 11:33 PM. Reason: unsuccessful in adding hyperlinks

  5. #20
    Registered User
    Join Date
    Apr 2011
    Location
    Karachi, Pakistan
    Posts
    19
    P.S. could ne1 tell me how to add hyperlinks here and from where to turn HTML ON.....???

  6. #21
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,001
    Quote Originally Posted by Lord Slytherin
    one thing I'd like to clarify is that principles NEVER change however moderen you may become.....The principles of "sequencing instructions" on the punched cards laid down by Hon. Lady Ada Lovelace are the very same which are still in vogue for creating Algorithms, however we've now shifted from the use of punched cards....this is what's happening...same underlying principles; many-faceted technologies.
    Not really: some fairly general/core principles continue to apply, but principles and paradigms do evolve as people come up with new ideas of how to program.

    Quote Originally Posted by Lord Slytherin
    Turbo C might not be very compatible with its brother compilers, but it still offers the easy learning of founding programming skills. You know after learning C++ on the same compiler, we'd be expert enough to start working on JAVA which is our next course....
    You can start learning Java with or without knowing C++. You cannot start programming properly in Java without learning sufficient Java, no matter how expert you are in C++ (and vice versa).

    As for "learning of founding programming skills": there is truth in this, but in practice it is easier to get help and try out examples if your example code is immediately compilable by others and if the example code provided to you (or which you find in books or online) is immediately compilable by you. So, yes, you can learn how to program using Turbo C, but it will just be more difficult. After all, you can learn how to program without a computer, but that will just be even more difficult.

    Quote Originally Posted by Lord Slytherin
    P.S. could ne1 tell me how to add hyperlinks here and from where to turn HTML ON.....???
    Use [url=http://example.com]example[/url] for example.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #22
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    one thing I'd like to clarify is that principles NEVER change however moderen you may become
    As laserlight has pointed out, They do evolve. and currently languages with good concurrent support are the future languages.
    You might find yourself in trouble when you find that what you've been always doing in Turbo C is no longer accepted in C standard. (eg modifying string literal).
    Bad habits are hard to break.

    You know after learning C++ on the same compiler
    Wow on same compiler!, you know C++ evolve much since then...
    Good luck with your o'd compiler.

  8. #23
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Yes whatever.....one thing I'd like to clarify is that principles NEVER change however moderen you may become.....
    If ever there was a dune lined up for one rude awakening...

  9. #24
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,203
    I think this thread should win an award for having the most off-topic title at the start of the thread, to having the most on-topic title at the end of the thread!

    I have no idea what this thread is about - what a great title for the thread!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  10. #25
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Salem View Post
    I think this thread should win an award for having the most off-topic title at the start of the thread, to having the most on-topic title at the end of the thread!

    I have no idea what this thread is about - what a great title for the thread!
    LOL.... well I do try to stay on topic as much as possible...

  11. #26
    Registered User
    Join Date
    Mar 2011
    Posts
    21
    Quote Originally Posted by Lord Slytherin View Post
    One thing more....

    You see I run my programme just recently, and when it asked the question I typed 'q' . Its result was that the programme run correctly this time. My answer ws accepted and I was awarded 4 points.
    Any explaintion for this...??
    I have no idea if Salazar is even reading this thread any more (I somewhat doubt it), but just in case

    Because that's what you programmed it to do? I don't really have any idea how your compiler works (it's almost as old as I am, for Christ's sake), but I suspect that if you're not getting a segfault then it you're either writing to space you shouldn't be able to write to, or perhaps your compiler is wrapping subscripts for you. The former seems FAR more likely than the latter. Subscripts 1-14 of your array are blank (i.e., your whole array), and you write (starting at [15]) "q\n\0". Your test condition only checks for a single character, so you are trivially correct. You really need a new understanding of arrays in C, and how they apply to strings in C, as well as pointers, dereferencing, Standard Input, etc. All things that should have been covered in your classroom long before you came to us for help. If you need help with that, then great, but this really isn't the thread to do it in.

    Listen, I know this isn't exactly your world, but you have to understand that you traipsed in here with a 20 year old compiler and a stodgy, 20 year old view of CS and programming. If you really think that all programming is the same, then I suggest you take a look at Prolog or Haskell. They will blow your mind. Lots of people offered you help in this thread, and your sanctimonious responses are the reasons you're not getting anything out of it. Kmess literally handed you a major bug (and the appropriate rewrite), and you blew him off with what amounted to "I'm not stupid!"

    Also, your little diatribe about the history of programming has to be the most ridiculous thing I've ever seen. Did you really think you were going to march onto a board populated entirely by C programmers and tell them how it works? Most of the people here have dedicated YEARS to this, and continue to dedicate their lives to staying current. I'm happy for you that you're taking an intro to CS class, but ........ off. That'd be like if I asked you for help on a physics problem, and when you said "Oh, you have to take certain other factors into account - this methodology is really out of date", I lectured you on how Newton's laws applied to everything. If you want people who are clearly your superiors to help you with your issues, perhaps a dollop of contrition is the best way to go.

  12. #27
    Registered User
    Join Date
    Mar 2011
    Posts
    21
    Quote Originally Posted by Lord Slytherin View Post
    @ CommonTater



    Not the luck....this is a very lowly suggestion by you whom I believe to be a very proficient C programmer....
    Luck....easy explaination of complexities eh...?
    Better say nothing...
    And for the record, he was right. Your code shouldn't even run, by modern C standards. You literally got lucky with memory addressing.

  13. #28
    Registered User
    Join Date
    Apr 2011
    Location
    Karachi, Pakistan
    Posts
    19

    Wink You guessed it right....4 points to all!!

    Dear friend FrankTKM...

    Yes you're right on a good many things....there're people who helped me really helpfully (like Kmess,Phenninger,laser light and yourself too!), but there were people too who took a very critical approach of me to the point of disdain at times...I mean if someone hints that I'm still living in the stone age of programming and making use of such primitive gadgets as 3.5 inch floppy disk or having the same choice as of old alcoholics, how should I respond...??
    Critcism, like that of laser light's or yours, has its merits. I really benefitted from it. But when help is interspersed with disdainful remarks, its bad enough to carry you off your topic and your good mood.
    Now hear a good news, by you people's advices, I've been able to correct that quiz progrmme of mine and learn the uses of puts() and strcmp() functions. I'll post its coding in a little time.
    And one thing more, you know I'm still on the chapter of 'DECISIONS in C'; the quiz programme was its relavent assignment problem I'm abt to proceed to 'FUNCTIONS' ndI know as much about Arrays as its name only.The reason why I wntd to employ arrays into my prog (when I dont know much abt them) was that I wntd to input string into my quiz instead of MCQ choices nd someone told me to put square brackets after your input- variable nd type in how many characters long I need it to be....ha ha ha....!! that caused all the fuss...

    but thanx to many advisers of cboard...MISSION ACCOMPLISHED

    Exclusive thanks to KMESS and Pheninger nd say... to Commontater too...

    You all have a lucky Day....!!
    GOD save Prince William and Kate Middleton....may they live a happy matrimonial life...

  14. #29
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    ...I mean if someone hints that I'm still living in the stone age of programming and making use of such primitive gadgets as 3.5 inch floppy disk or having the same choice as of old alcoholics, how should I respond...??
    We weren't hinting. Really... there are plenty more modern compilers you can use, they are free and easily downloaded...
    Here's one --> Pelles C (Works with anything newer than a 386 CPU)
    And there are several more... google for MinGW, Code::Blocks, MS Visual C++ ...

    So unless you are running some truly ancient DOS only computer, there is no reason and no excuse to be working with such wildly outdated tools. It's like pounding nails with rocks, when you could have a power-hammer.

    And... something to learn about computer people... Amongst ourselves we tend to be very direct... "Fix this", "That is wrong", "You're making a mistake"... This is not rudeness, it's direct and concise communication. If you're going to take it personally, you're getting into the wrong trade because you will spend your days having your ego repeatedly pounded into the ground by people who are more than happy to lend a hand...
    Last edited by CommonTater; 04-29-2011 at 07:56 AM.

  15. #30
    Registered User
    Join Date
    Apr 2011
    Location
    Karachi, Pakistan
    Posts
    19
    Hi there...

    This programme is workng fine except for one little problem....have a look:
    Code:
    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    void main()
    {
     char guess[15];
     int score;
     clrscr();
     printf("\"LET'S START\"\nPlease turn on your Caps Lock.\n\n");
      {
      score=0;
      printf("(1) Which country is called \"The Land of The Risisng Sun\" ?\n");
      gets(guess);
      guess[15] = (strcmp(guess,"JAPAN") == 0) ? 0:1;
      switch ( guess[15] )
    	 {
    	  case 0:
    		printf("That's corrrrrrect\n");
    		printf("Your score is %d.",score+4);
    		break;
    	  case 1:
    		 printf("Wrong Answer\nTry again\n");
    		 gets(guess);
    		 if (strcmp(guess,"JAPAN") == 0)
    		 {
    		  printf("Correct\nYour score is %d.",score+2);
    		  break;
    		 }
    		 else
    		 printf("Wrong again\nTry once more\n");
    		 gets(guess);
    		 strcmp(guess,"JAPAN");
    		 if(strcmp(guess,"JAPAN") == 0)
    		 {
    		  printf("\nright this time\nscore=%d",score+1);
    		  break;
    		 }
    	  default:
    		printf("SORRY You LOST!\nThe answer is \"JAPAN\".");
    		printf("Your score is %d.",score);
    		break;
    	 }
      printf("\n\n(2) In Which country does Mount Fuji locates?\n");
      gets(guess);
      guess[14]=(strcmp(guess,"JAPAN") == 0) ? 0:1;
      switch( guess[15] )
    	{
    	 case 0:
    		printf("\nCorrrrrect!\nscore=%d",score+4);
    		break;
    	 case 1:
    		printf("You're wrong\nTry again\n");
    		gets(guess);
    		if(strcmp(guess,"JAPAN") == 0)
    		{
    		 printf("That's Right!\nscore=%d",score+2);
    		 break;
    		}
    		else
    		printf("Wrong again.\nTry again");
    		gets(guess);
    		if(strcmp(guess,"JAPAN")==0)
    		{
    		 printf("Right this time.\nscore=%d",score+1);
    		 break;
    		}
    	 default:
    		printf("SORRY you lost!\n\"JAPAN\" is the answer.\n");
    		printf("score=%d",score);
    		break;
    	}
      }
     getch();
    }
    The problem is that the score empties to zero when we reach the next question.
    How can it store the score from the last question ??
    Your advice please...

    Awaiting

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can u guess my number?
    By hotsox in forum C Programming
    Replies: 2
    Last Post: 01-07-2006, 01:40 PM
  2. can u guess my number?
    By strider496 in forum C Programming
    Replies: 16
    Last Post: 03-22-2005, 10:19 PM