Thread: noob help

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    2

    noob help

    Hi, I'm using Dev-C++ and according to the book I'm reading the following code should display:

    ch1 = H and ch2 = A


    Code:
    #include <stdio.h>
    
    main()
    {
          int ch1,
              ch2 = `A´;
              
              ch1 = ch2+7;
              
              printf("\nch1 = %c and ch2= %c\n", ch1, ch2);
              
              fflush(stdin);
              getchar();
    }
    The problem is that the program doesn't accept the `A´ part, it is Dev-C++ or am i doing something wrong, it's probably something simple but I'm new at this...

    Thanks!

  2. #2
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    Its 'A' not `A` or whatever you wrote...
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    75
    It's not `A´, but 'A'

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    2
    Thanks! now it works.

    But my book does say `A´ (C for business programming, John C. Molluzzo)

  5. #5
    Registered User SKeane's Avatar
    Join Date
    Sep 2006
    Location
    England
    Posts
    234
    Different fonts. Some word-processor type programs use "smart" quotes. They don't mix well with code.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > fflush(stdin);
    If your book tells you to do this, you need a different book.

    See the FAQ - flushing input streams is undefined.
    - your input stream is flushed.
    - my input stream is unchanged.
    - her hard disk is reformatted.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Noob Q: How to read a value of a byte in binary?
    By Hitsuin in forum C++ Programming
    Replies: 2
    Last Post: 06-11-2009, 02:46 PM
  2. Noob Questions...
    By Firemagic in forum C++ Programming
    Replies: 4
    Last Post: 04-19-2006, 03:57 PM
  3. my noob program doesnt work
    By Scarvenger in forum C++ Programming
    Replies: 2
    Last Post: 10-19-2005, 11:40 AM
  4. noob needs help!!!!:(
    By tykenfitz in forum C Programming
    Replies: 1
    Last Post: 07-10-2005, 08:49 AM
  5. noob: compiling error... plz help!
    By chosii in forum C Programming
    Replies: 2
    Last Post: 05-10-2002, 05:53 AM