C Programming Codes for Getting the Octane Level of the User Location

Asked By 40 points N/A Posted on -
qa-featured

I need to make a program using C Programming that will get the standard input of the user's location and establish the cost of the octane level of the given location.

This program should contain three functions. The first one is to behaviorally ask and read the location of the user which will pass to the next function that will conclude the prices of each given level. And then, all the information should be printed in horizontal form.

Assuming that the usual gas tank holds 15 gallons and the rate for each user's locations are:

                         Regular          High Level          Super Level

City                   1.254               1.309                      1.399

District             1.139               1.179                      1.279

It should have an output like this:

Enter Location / District: (User will enter the City)

The average prices for the inputted city are:

Regular                 High Level                    Super Level

$18.81                     $19.64                            $20.99

I hope you can provide the codes for this.

Thanks in advance.

SHARE
Best Answer by James L Evans
Best Answer
Best Answer
Answered By 5 points N/A #163370

C Programming Codes for Getting the Octane Level of the User Location

qa-featured

Hello, I have seen the problem. You can take a string input from user by gets(str) code.

Then parse the string to the second function where comparing two string(strcmp(str,"City")). Then  you call the third function  from 2nd function by parsing the value of octanes. In third function, some calculations needed.

Be careful the price value of octane is double value.

Hope, now u can solve it.

Thanks.

Related Questions