Like Tree1Likes
  • 1 Post By AndiPersti

Need help with C Project :)

This is a discussion on Need help with C Project :) within the C Programming forums, part of the General Programming Boards category; Hello, I have been working on this project; I am still very new to programming in general. I have been ...

  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:

    Name:  cop2.png
Views: 342
Size:  44.9 KB

    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
    rags_to_riches likes this.

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, 12: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, 07: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, 04:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21