Thread: If Else - Magic Game

  1. #1
    Registered User
    Join Date
    Mar 2014
    Posts
    6

    If Else - Magic Game

    Code:
    Please solve my problem!
    
    When i am entering single character instead of 'miz' then it is working great. But when i am using multi character like 'miz' it is showing error output. i did this program with c++ it is working but not working in c.
    
    When i am running this program it is showing {warning] multi character constant.
    Code:
    #include<stdio.h>
    #include<string.h>
    
    main()
    {
          char a;
    
          printf("Please Enter your First Name: ");
          scanf("%s",&a);
    
          if(a=='miz')
    
          {
          printf("\n\aYou are awesome");
          }
    
          else
          {
          printf("\n\aYou are not awesome");
          }
    
          getch();
    }

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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. If Else - Magic Game
    By Loucogame in forum C Programming
    Replies: 10
    Last Post: 03-26-2014, 02:04 PM
  2. Magic Box
    By dantu1985 in forum C Programming
    Replies: 5
    Last Post: 08-18-2007, 12:04 PM
  3. help on magic square
    By katway in forum C Programming
    Replies: 2
    Last Post: 03-07-2005, 06:44 PM
  4. the magic of MAGIC numbers
    By borko_b in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 06-27-2002, 02:36 AM
  5. A little STL magic please?
    By QuestionC in forum C++ Programming
    Replies: 2
    Last Post: 02-12-2002, 05:56 PM

Tags for this Thread