write my assignment 30546

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>

// This source file needs to “know about” the structures you declared

// in the header file before referring to those new types:

// HINT: put the header file name in double quotes so the compiler knows

//    to look for it in the same directory/folder as this source file

// #include your contacts header file on the next line:

#include “contacts.h”

int main (void)

{

  // Declare variables here:

struct Name name = {“”,””,””};

struct Address address = {0,””,0,””,””};

struct Numbers numbers = {“”,””,””};

char prompt;

  // Display the title

printf(“Contact Management Systemn”);

printf(“————————-n”);

  // Contact Name Input:

printf(“Please enter the contact’s first name: “);

scanf(“%30s”, name.firstName);

printf(“Do you want to enter a middle initial(s)? (y or n): “);

scanf(“%s”,&prompt);

if (prompt == ‘y’ || prompt == ‘Y’)

{

printf(“Please enter the contact’s middle initial(s): “);

scanf(“%6s”, name.middleInitial);

}

printf(“Please enter the contact’s last name: “);

scanf(“%30s”, name.lastName);

  // Contact Address Input:

printf(“Please enter the contact’s street number: “);

scanf(“%d”, &address.streetNumber);

printf(“Please enter the contact’s street name: “);

scanf(“%40s”, address.street);

printf(“Do you want to enter an apartment number? (y or n): “);

scanf(“%s”, &prompt);

if (prompt == ‘y’ || prompt == ‘Y’)

{

printf(“Please enter the contact’s apartment number: “);

scanf(“%d”, &address.apartmentNumber);

}

while (getchar() != ‘n’);

printf(“Please enter the contact’s postal code: “);

scanf(“%[^n]”, address.postalCode);

printf(“Please enter contact’s city: “);

scanf(“%40s”, address.city);

  // Contact Numbers Input:

printf(“Do you want to enter a cell phone number? (y or n): “);

scanf(“%s”, &prompt);

if (prompt == ‘y’ || prompt == ‘Y’)

{

printf(“Please enter the contact’s cell phone number: “);

scanf(“%20s”, numbers.cell);

}

printf(“Do you want to enter a home phone number? (y or n): “);

scanf(“%s”, &prompt);

if (prompt == ‘y’ || prompt == ‘Y’)

{

printf(“Please enter the contact’s home phone number: “);

scanf(“%20s”, numbers.home);

}

printf(“Do you want to enter a business phone number? (y or n): “);

scanf(“%s”, &prompt);

if (prompt == ‘y’ || prompt == ‘Y’)

{

printf(“Please enter the contact’s business phone number: “);

scanf(“%20s”, numbers.business);

}

  // Display Contact Summary Details

printf(“Contact Detailsn”);

printf(“—————n”);

printf(“Name Detailsn”);

printf(“First name: %s”, name.firstName);

printf(“n”);

printf(“Middles initial(s): %s”, name.middleInitial);

printf(“n”);

printf(“Last name: %s”, name.lastName);

printf(“nn”);

printf(“Address Detailsn”);

printf(“Street number: %d”, address.streetNumber);

printf(“n”);

printf(“Street name: %s”, address.street);

printf(“n”);

printf(“Apartment: %d”, address.apartmentNumber);

printf(“n”);

printf(“Postal Code: %s”, address.postalCode);

printf(“n”);

printf(“City: %s”, address.city);

printf(“nn”);

printf(“Phone Numbers:”);

printf(“n”);

printf(“Cell phone number: %s”, numbers.cell);

printf(“n”);

printf(“Home phone number: %s”, numbers.home);

printf(“n”);

printf(“Business phone number: %s”, numbers.business);

printf(“nn”);

// Display Completion Message

printf(“Sturcture test for Name, Address, and Numbers Done!”);

printf(“n”);

  return 0;

}

/* SAMPLE OUTPUT:

Contact Management System

————————-

Please enter the contact’s first name: Tom

Do you want to enter a middle initial(s)? (y or n): y

Please enter the contact’s middle initial(s): Wong

Please enter the contact’s last name: Song

Please enter the contact’s street number: 20

Please enter the contact’s street name: Keele

Do you want to enter an apartment number? (y or n): y

Please enter the contact’s apartment number: 40

Please enter the contact’s postal code: A8A 4J4

Please enter the contact’s city: Toronto

Do you want to enter a cell phone number? (y or n): Y

Please enter the contact’s cell phone number: 905-111-6666

Do you want to enter a home phone number? (y or n): Y

Please enter the contact’s home phone number: 705-222-7777

Do you want to enter a business phone number? (y or n): Y

Please enter the contact’s business phone number: 416-333-8888

Contact Details

—————

Name Details

First name: Tom

Middle initial(s): Wong

Last name: Song

Address Details

Street number: 20

Street name: Keele

Apartment: 40

Postal code: A8A 4J4

City: Toronto

Phone Numbers:

Cell phone number: 905-111-6666

Home phone number: 705-222-7777

Business phone number: 416-333-8888

Structure test for Name, Address, and Numbers Done!

*/

When I enter the bold in the output the cell phone number part does not show up. Can you tell me what the problem is.

 
"Not answered?"
Get the Answer