tubeshowcase●1,126,073 videos♡ My collection 0
← Learn to Code

Learn to Code08:44

Let's code a shopping cart program with C programming 🛒

Bro Code ↗

From the creator

#coding #programming #cprogramming This is a beginner's practice project to help you get accustomed to accepting user input in C. // SHOPPING CART PROGRAM char item[50] = ""; float price = 0.0f; int quantity = 0; char currency = '$'; float total = 0.0f; printf("What item would you like to buy?: "); fgets(item, sizeof(item), stdin); item[strlen(item) - 1] = '\0'; printf("What is the price for each?: "); scanf("%f", &price); printf("How many would you like?: "); scanf("%d", &quantity); total = price * quantity; printf("\nYou have bought %d %s/s\n", quantity, item); printf("The total is: %c%.2f", currency, total); return 0;

Published 2025-02-28 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code