Like Tree7Likes

Idea for final project

This is a discussion on Idea for final project within the General Discussions forums, part of the Community Boards category; I am trying to come up with an idea for a final project in my C programming class and can't ...

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    35

    Idea for final project

    I am trying to come up with an idea for a final project in my C programming class and can't think of a good one.
    The program is to be made in Pelles C as a win32 console program and must contain the following:

    Must use "functions"
    Must use "if" statements
    Must contain "loops"
    Must have a "menu"
    Must end with a "sentinel"
    and it must contain at least 150 lines of code.

    any ideas on what i should write?
    any idea and maybe some hints on how to make the program flow would be much appreciated.

    THANKS!

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Floyd-Warshall implemented in an iterative way.Set as bonus to class to compute which is the shortest path too.If they know recursion why not let them have fun with a recursive implementation too?
    This will be more complex than what you want.
    Functions,if/else,loops,menu is there.I do not know what is a sentinel :/

    Another idea is the reversi game that this is much heavier project.
    It has all the above,plus lists ,save/load and moooore...

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    2,572
    How about a "phone book" application? Allow users to enter, delete, or sort the names/numbers (menu), and each selection can be written in its own function. "if" statements and loops would be naturally be required to implement the logic required for such a program.

    any idea and maybe some hints on how to make the program flow would be much appreciated.
    A simple flow chart would help you see the logical flow of the program quite clearly.

  4. #4
    Registered User
    Join Date
    Nov 2012
    Posts
    35
    To std10093: This is a pretty basic C programming class, as I am only in my second semester and many of this i have not learned yet, building a program like this is too complex for me right now. What we have learned is pretty much the list of things the program must contain, going above and beyond that is outside of my grasp right now. this is regular C not C++ and I don't have any prior experience with any other language. I know, I know, I'm not too advanced yet, but I have to start somewhere.

  5. #5
    Registered User
    Join Date
    Nov 2012
    Posts
    35
    Quote Originally Posted by Matticus View Post
    How about a "phone book" application? Allow users to enter, delete, or sort the names/numbers (menu), and each selection can be written in its own function. "if" statements and loops would be naturally be required to implement the logic required for such a program.
    A few problems i see here is when you exit the program all information is lost, defeating the point of trying to store user information in a "phone book" like way since any information typed inside the program does not change the code. I understand the implementation, but I am hoping for a program that has real world application everytime i open the program.

  6. #6
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    Quote Originally Posted by friedsandwich View Post
    A few problems i see here is when you exit the program all information is lost, defeating the point of trying to store user information in a "phone book" like way since any information typed inside the program does not change the code. I understand the implementation, but I am hoping for a program that has real world application everytime i open the program.
    Are you aware of file operations? You could easily save / load data from a binary file.

  7. #7
    Registered User
    Join Date
    Jun 2011
    Posts
    2,572
    std10093 responded to that well.

    However, it seems like file I/O might be more difficult than you're ready to handle. Just to note: it could take several dozens of programs worth of experience before you can start writing code with a useful application.

    How about this one? A simple [and severely limited] calculator. Select the operation from a menu, enter the two operands, and write a function that performs the selected operation on the numbers entered by the user. Repeat until the user enters a specific value.

  8. #8
    Registered User
    Join Date
    Nov 2012
    Posts
    35
    Quote Originally Posted by std10093 View Post
    Are you aware of file operations? You could easily save / load data from a binary file.
    I'm not sure how that is done. or even what that means to be honest. Hopefully I don't sound too stupid here I AM just learning programming, this must be a "Win32 Console Program" that i can write at home and/or school and then present it on a different computer without having any other files/programs used to operate the project. The only thing I have been able to think of is some sort of calculator, but with that I don't know where to stop when it comes to types of calculations, so i was hoping for something a little more clear cut with the parameters of the program.

  9. #9
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    No you are not stupid.You are a beginner

    I vote for calculator too.

  10. #10
    Registered User
    Join Date
    Nov 2012
    Posts
    35
    Quote Originally Posted by Matticus View Post
    std10093 responded to that well.

    However, it seems like file I/O might be more difficult than you're ready to handle. Just to note: it could take several dozens of programs worth of experience before you can start writing code with a useful application.

    How about this one? A simple [and severely limited] calculator. Select the operation from a menu, enter the two operands, and write a function that performs the selected operation on the numbers entered by the user. Repeat until the user enters a specific value.
    ha ha didn't read your post before i wrote my last one. That was the only idea i could come up with too. I am just hoping that it's not too limited by just using the <math.h> file and no coding of my own if that makes sense.

  11. #11
    Registered User
    Join Date
    Jun 2011
    Posts
    2,572
    Then simply write your own math functions instead of using math.h. It's common, during the learning process, to write functions that mimic standard functions, in order to gain a better understanding of the language.

  12. #12
    Registered User
    Join Date
    Nov 2012
    Posts
    35
    Yeah i Think this could be a good project. I'm thinking operations of:
    addition of x and y, subtraction of x and y, multiplication of x and y, division of x and y, absolute value of x, square root of x, x to the power of y, a bunch of formulas to find the area of different shapes, and possibly finding the GCF of x and y, and the factors of x.......... what else should i add or not have in there?

  13. #13
    Registered User
    Join Date
    Jun 2011
    Posts
    2,572
    That's a good start. Just a word of caution - those new to programming tend to start writing all of their code at once, and hit a wall of warnings/errors when they're finally ready to test it. I don't know if this applies to you, but a good development process doesn't seem to be taught as much as it should be. Get the basics working first, and take it step by step. My recommendation:

    1. Write a program with a "menu" function. The menu function will print out the menu, receive user input, and return the user input as an integer. Verify that this works correctly.

    2. Add an "addition" function to the program, that will be executed when the user enters the appropriate menu selection. Also include user input prompt. Verify that this works correctly.

    3. Put the user input and menu selection within a loop. Verify that this works correctly.

    4. Expand your program to include "subtraction", "division", and "multiplication" functions. Update the menu and main program loop. Verify that this works correctly.

    From here, you can add new menu items and associated function (one at a time), knowing that the structure of the program works correctly, leaving you free to code/troubleshoot each new function on its own.
    friedsandwich likes this.

  14. #14
    Registered User
    Join Date
    Nov 2012
    Posts
    35
    having a problem with finding the quotient of two numbers.... a switch statement won't allow me to use a double so finding the quotient of 15/4 is coming up with the answer 3... how do i fix this problem?

  15. #15
    Registered User
    Join Date
    Nov 2012
    Posts
    35
    my code so far.....

    Code:
    #include <stdio.h>
    #include <math.h>
    
    
    int main(void)
    {
    int sum, first_Num, sec_Num, diff, product, quotient;
    int choice;
        do
            {
            printf("\nChoose what calculation to perform\n");
            printf("\t1 - Addition\n");
            printf("\t2 - Subtration\n");
            printf("\t3 - Multiplication\n");
            printf("\t4 - Division\n");
            printf("\t5 - Square Root\n");
            printf("\t6 - Exponents\n");
            printf("\t7 - Absolute Value\n");
            printf("\t8 - Area of Shapes\n");
            printf("(Enter a zero to exit) \n");
            printf("What is your choice? ");
            scanf("%d", &choice);
    
    
            switch (choice)
            {
                case 1: 
                {
                    printf("Enter first number: ");
                    scanf("%d", &first_Num);
                    printf("Enter second number: ");
                    scanf("%d", &sec_Num);
                    sum = first_Num + sec_Num;
                    printf("\nThe sum of %d and %d is %d\n\n", first_Num, sec_Num, sum);
                    break;
                }
                case 2:
                {
                    printf("Enter first number: ");
                    scanf("%d", &first_Num);
                    printf("Enter second number: ");
                    scanf("%d", &sec_Num);
                    diff = first_Num - sec_Num;
                    printf("\nThe difference of %d and %d is %d\n\n", first_Num, sec_Num, diff);
                    break;
                }
                case 3:
                {
                    printf("Enter first number: ");
                    scanf("%d", &first_Num);
                    printf("Enter second number: ");
                    scanf("%d", &sec_Num);
                    product = first_Num * sec_Num;
                    printf("\nThe product of %d and %d is %d\n\n", first_Num, sec_Num, product);
                    break;
                }
                case 4:
                {
                    printf("Enter first number: ");
                    scanf("%d", &first_Num);
                    printf("Enter second number: ");
                    scanf("%d", &sec_Num);
                    quotient = first_Num / sec_Num;
                    printf("\nThe quotient of %d and %d is %d\n\n", first_Num, sec_Num, quotient);
                    break;
                }
            }
        }
        while (choice != 0);
    return (0);
    }
    I tried using %f, %lf and declaring quotient as a double, it gives me a bad data return
    Last edited by friedsandwich; 11-12-2012 at 11:18 AM.

Page 1 of 4 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ideas for a final project
    By doubleanti in forum General Discussions
    Replies: 11
    Last Post: 09-09-2012, 08:00 AM
  2. Must be final project time again....
    By VirtualAce in forum General Discussions
    Replies: 21
    Last Post: 05-19-2010, 07:04 PM
  3. Final Project for HS, any ideas?
    By Conneticut#88 in forum C++ Programming
    Replies: 13
    Last Post: 05-24-2006, 09:22 PM
  4. Final year project
    By afisher in forum C# Programming
    Replies: 3
    Last Post: 07-04-2005, 08:15 AM
  5. Final year project
    By khpuce in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 10-10-2003, 07:04 AM

Tags for this Thread


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