Purchase Solution

C Programming Help

Not what you're looking for?

Ask Custom Question

C Programming Problem. I need help writing a program in C that meets the following criteria:
1) There are 5 products for sale at a grocery store ( I want to use cucumbers, lettuce, grapes, apples and bananas)
2) The five products are all sold by weight (pounds).
3) Customers need to be prompted to enter the price (per pound) for each of the products (cucumbers, lettuce, grapes, apples and bananas)
4) A customer has a unique request. He wants to know the maximum amount of each product that can be purchased for $10.
5) Computer & output the maximum weight of each product the customer can buy for $10.
6) Include comments within the code to explain each of the functional areas.

Purchase this Solution

Solution Preview

#include <stdio.h>

int main(int argc, char **argv)
{
float price[5];//price array variable is declared as float to accept price of 5 vegetables
int i; //declare i as integer for looping
char vegetables[5][10] = {"Cucumber","Lettuce","Grapes","Apples","Bananas"} ;

char f,e; //f is a character for prompting user to get maximum weight, e is a character to quit
float quantity; //quantity is a float variable ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

C# variables and classes

This quiz contains questions about C# classes and variables.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.