www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/16/13:16:40

From: "WillB" <exSite DOT Website AT btinternet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: <NEWBIE> why does this not work?
Date: Thu, 16 Jul 1998 18:08:33 +0100
Organization: BT Internet
Lines: 54
Message-ID: <6olca3$8ps$1@mendelevium.btinternet.com>
NNTP-Posting-Host: host5-99-58-83.btinternet.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I can't get this program to work. It is supposed to ask for name, age, and
month of birth, then print the name and age, then if else the different
months to choose the correct description of their horoscope. DJGPP tells me
january is undeclared and febuary is undeclared. What am I doing wrong. I'm
sorry if I have done something stupid- but I am new to this. Program is
below (in C)

Thanks in advance,
Will
exSite DOT Website AT btinternet DOT com



*************************************PROGRAM*******************


#include <stdio.h>

int main()
{


char name[20];
 short age;
 char month[10];

    printf("hello, and welcome to my little program\n");

    printf("Please enter your name...\n");
        scanf("%s", name);
    printf("Please enter your age...\n");
        scanf("%i", &age);
    printf("please enter the month you were born in lowercase..\n");
        scanf("%s", month);

 printf("So your name is %s and your age is %i \n", name, age);

if(month==january)
         printf("And your star sign is Capricorn(22 Dec-20 Jan) or
Aquarius(21 Jan-19 Feb)\n");
  else if(month==february)
      pritnf("And your star sign is Aquarius(21 Jan-19 Feb) or Pisces(20
Feb-20 Mar)\n");
  else
      printf("And I can't be arsed to write 'if else's' to find your star
sign - try January or     February\n");

 printf("Thank you - and goodbye....\n");

return 0;
}



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019