Thread: Need help with C Project :)

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    3

    Need help with C Project :)

    Hello,

    I have been working on this project; I am still very new to programming in general. I have been able to get parts of it right but the other parts I kept getting errors throughout, and have just given up a bit. Any help is appreciated thanks.

    Problem:

    Need help with C Project :)-cop2-png

    My Code so far:

    Code:
    #include<stdio.h>#include<conio.h>
    
    
    void main()
    {
    
    
    int month,date,year;
    char* arr[]={"january","Febaruary","March","April","May","June","July","August","September","October","November","December"};
    
    
    clrscr();
    printf("Please enter the date in the format dd,mm,yy\n");
    scanf("%d %d %d",&date,&month,&year);
    switch(month)
    {
    case 1:
    printf("%s %d %d \n",arr[0],date,year);
    break;
    case 2:
    printf("%s %d %d \n",arr[1],date,year);
    break;
    case 3:
    printf("%s %d %d \n",arr[2],date,year);
    break;
    case 4:
    printf("%s %d %d \n",arr[3],date,year);
    break;
    case 5:
    printf("%s %d %d \n",arr[4],date,year);
    break;
    case 6:
    printf("%s %d %d \n",arr[5],date,year);
    break;
    case 7:
    printf("%s %d %d \n",arr[6],date,year);
    break;
    case 8:
    printf("%s %d %d \n",arr[7],date,year);
    break;
    case 9:
    printf("%s %d %d \n",arr[8],date,year);
    break;
    case 10:
    printf("%s %d %d \n",arr[9],date,year);
    break;
    case 11:
    printf("%s %d %d \n",arr[10],date,year);
    break;
    case 12:
    printf("%s %d %d \n",arr[11],date,year);
    break;
    default:
    printf("nothing else\n");
    
    
    }
    
    
    gotoxy(20,10);
    printf("end program\n");
    gotoxy(20,11);
    printf("*************");
    getch();
    
    
    }
    Thanks in advance!!

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Please indent your code properly in future postings.

    Code:
    void main()
    The correct form is
    Code:
    int main(void)
    Code:
    printf("Please enter the date in the format dd,mm,yy\n");
    scanf("%d %d %d",&date,&month,&year);
    You should more carefully read your assignment. For a start, your assignment clearly states how you should prompt the user and how you should use scanf():
    Write a program that asks the user to input a date in the form of mm/dd/yyyy, ...
    Try to fix this part first.

    Bye, Andreas

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Classes Project (Not class project)
    By adam.morin in forum C++ Programming
    Replies: 3
    Last Post: 02-28-2011, 01:48 AM
  2. Paid project - The Free Marketing Project
    By sharefree in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 10-27-2010, 02:15 PM
  3. Help me with my project
    By ewic0190 in forum C Programming
    Replies: 17
    Last Post: 03-17-2010, 06:56 PM
  4. Project Help
    By Fatima Rizwan in forum C++ Programming
    Replies: 1
    Last Post: 01-13-2010, 08:52 AM
  5. your 11th & 12th grade c++ project or similar project
    By sleepyheadtony in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 01-13-2002, 05:14 PM