Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8581775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:08:00+00:00 2026-06-11T21:08:00+00:00

This is a program that asks the user to input Shipping information about selling

  • 0

This is a program that asks the user to input Shipping information about selling bikes, pretty lame. At the end when it prints out the number of bikes order, and the total cost, the numbers get screwed up. The previously entered amounts seem to be sticking in the memory. How do I fix this? If that is not the problem I would not mind being told so 🙂

#include <stdio.h>
#include <math.h>
//structure
typedef struct
{char cust_name[25];
 char add_one[20];
 char add_two[20];
 }ORDER;

 ORDER order;

int main(void){
fflush(stdin);
system ( "clear" );

 //initialize variables
 double number_ordered = 0;
 double price;
 char bike;
 char risky;
 double m = 359.95;
 double s = 279.95;
    //inputs for order
    printf("Enter Customer Information\n");
    printf("Customer Name: ");
        scanf(" %[^\n]s", &order.cust_name);

    printf("\nEnter Street Address: ");
        scanf(" %[^\n]s", &order.add_one);

    printf("\nEnter City, State, and ZIP: ");
        scanf(" %[^\n]s", &order.add_two);

    printf("\nHow Many Bicycles Are Ordered: ");
        scanf(" %d", &number_ordered);

    printf("\nWhat Type Of Bike Is Ordered\n  M Mountain Bike \n  S Street Bike");
   printf("\nChoose One (M or S): ");
       scanf(" %c", &bike);

    printf("\nIs The Customer Risky (Y/N): ");
        scanf(" %c", &risky);

    system ( "clear" );

    //print order
    printf("\n**********Shipping Instructions**********");
    printf("\nTo: %s\n    %s\n    %s", order.cust_name, order.add_one, order.add_two);

    if (bike == 'M' || bike == 'm')
        printf("\n\nShip: %d Mountain Bikes", number_ordered);
    else 
        printf("\n\nShip: %d Street Bikes", number_ordered);

    if (bike == 'M' || bike == 'm')
        price = number_ordered * m;
    else
        price = number_ordered * s;

    if (risky == 'Y' || risky == 'y')
        printf("\nBy Freight, COD %d\n", price);
    else
        printf("\nBy Freight, And Bill The Customer %d\n", price);


        printf("*****************************************\n");
        return 0;
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:08:01+00:00Added an answer on June 11, 2026 at 9:08 pm

    You are printing number_ordered and price, which are doubles, using %d. %d is only for integer types. Use %lf to printf or scanf doubles.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've written a Binary Tree program that asks the user questions to learn about
I'm thinking about writing a program that asks the user to think of an
So i had to write a program that asks for a user input (which
I am writing a function for a program that asks the user to input
I bought this program that created a pretty nice imageuploader flash script however I
I'm working on a Serpinski triangle program that asks the user for the levels
I'm making a program that asks for an integer from the user, it then
I've a custom installer program that has worked fine, but it asks the user
Can anyone help with this exersise? Write a program which asks the user for
I want to write a program in C or C++ that asks to user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.