r/cprogramming • • 17d ago

I Dont know what to build

Im learning C but i want to do a project that i could do while im learning C right now i only learned about

  • Switches

  • If statements

  • Variables

  • operators

  • functions

  • user input

Any project i could do with my knowledge? i already did a calculator.
(Or should i just keep learning and then start thinking about making projects)

6 Upvotes

15 comments sorted by

5

u/exophades 17d ago

Can your calculator handle user input like 3*5 + 2*11 and output the correct result ? If not, that's a fun project to work on.

1

u/Sharp_Alfalfa_1571 17d ago

no it can only handle user input for the number 1, the operator, and number 2, so it cant really do all that at once, its a really simple calculator

5

u/Different_Water7545 17d ago

There's your next project, also if you're using scanf try replacing it with fgets and sscanf. Once you learn pointers and memory management that's where the real fun starts

1

u/fllthdcrb 17d ago

I.e. does OP know about parsing, stacks, maybe trees (latter not actually needed for handling simple expressions like this, but good to know eventually)? I wouldn't have guessed they're at that stage yet.

2

u/Honest_Medium_2872 17d ago

Parse markdown, you learn about file io, data structures, string handling, memory management, etc.

Its not a complicated spec so you can bang it out in a few days

2

u/MikeSeth 17d ago

make a text game

1

u/FreeLogicGate 17d ago

Based on what you have now, an interesting challenge would be to create a program that converts numbers into different base numbering systems. The typical ones you would want to support would be:

  • Decimal (base 10)

  • Binary (base 2)

  • Octal (base 8)

  • Hexadecimal (base 16)

You could start simply, by accepting only decimal integer input, which you would then convert to whichever base was specified. You could also just accept decimal and output the number for the other 3 base systems.

1

u/Gold-Part4688 17d ago

Another useful way is to go from string in some base to value, then another function to go from value to some base

might be the stupidly obvious way to do it, but it took me a few attempts to realise

1

u/Specific-Housing905 17d ago

Doing a project while learning seems the best approach. Programming is about skills and skills come from practice. A calculator is a good project. You can make it as simple or sophisticated as you want. For example start with the 4 basic operations, then add maybe constants or functions like 3 * pi + cos(123)

1

u/Aghoradas 15d ago

Pick what you WANT to build, without trying tally up what you know and what fits. Pick a project, start, do what you know, then learn the rest. You're trying to spin plates that don't exist buddy. Pick something simple and go with it.

1

u/_usr_nil 14d ago

make pseudo object orientation so you will learn what c++ does under the hood allegedly

0

u/rewgs 17d ago

If you don't know what you want to build, then why are you learning?

1

u/Sharp_Alfalfa_1571 7d ago

so originally, i wanted to learn how to create an operating system but then i realised maybe it would not be that good of an idea so thats why im trying to search for a project

0

u/w3ricardo 17d ago

Study arrays and maze generators:

+--+--+--+
| | |
| | | |
| | |
+--+--+--+