[Show all top banners]

Udeshya
Replies to this thread:

More by Udeshya
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 Please help me for this.
[VIEWED 4129 TIMES]
SAVE! for ease of future access.
Posted on 02-22-12 10:05 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I need an urgent homework help. Please if anyone kows how to make a program please help me. I am not good at computer programming. I am taking this class as a requirements. I would be grateful if someone can help me with this program. Here is the program :

You will be making an inventory program.

You will have an array of 10 structure pointers. The structure will have a array of 15 characters (for the name) and an int (for the weight).

Allow the user to enter items in the inventory (they can decide to have one item or 10 items.) Only allocate memory if the inventory needs it. Have the item placed in the inventory array.

When the user is done entering items, print them all out. DO NOT PRINT OUT THE ITEMS UNTIL THEY HAVE ALL BEEN ENTERED! Then free the allocated memory

 
Posted on 02-22-12 12:26 PM     [Snapshot: 107]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Which Language ?

 
Posted on 02-22-12 12:38 PM     [Snapshot: 131]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 @ mulmiz ...

It is in "C".

I would appreciate your help.

 
Posted on 02-22-12 4:01 PM     [Snapshot: 256]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Is there anyone around who is good at C or C++ programming. Please guys help me out with this program.
 
Posted on 02-22-12 4:38 PM     [Snapshot: 307]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 


Last edited: 22-Feb-12 04:38 PM

 
Posted on 02-22-12 4:39 PM     [Snapshot: 322]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

It been too many years and Now I forgot how to write C code. This is what I have done so far - check to see if there are errors - I don't have compiler to run this code and I didn't print the values - so u have to do it urself.

If this doesnot compile then - my bad -

#include <stdio.h>
#include<string.h>

struct Person {
  char name[15];
  int weight;   
};

int main() {
 struct Person p[10];
 int num, i, weight;
 char name1[15];
 printf("\n How many items do u need to enter(1-10) ");
 scanf("%d",&num);
 while(num>1 || num <10) {
   printf("\n Re -enter number(1-10) ");
   scanf("%n"+num);
 }

 
 for(i=0; i<num; i++) {
   printf("\n Enter name "); 
   scanf("%s",name1);  
   p[i].name= name1;
   printf("\n Enter weight ");
   scanf("%d",&weight);  
   p[i].weight=weight;
 }

 return 0;

}

 
Posted on 02-23-12 12:57 AM     [Snapshot: 426]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

 @ Serial

 I truly thank you for helping me. It didn't work and I couldn't sort out what was wrong, but I appreciate your help. Thank you so much.

 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 30 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
Travelling to Nepal - TPS AP- PASSPORT
ढ्याउ गर्दा दसैँको खसी गनाउच
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
TPS Work Permit/How long your took?
मन भित्र को पत्रै पत्र!
Morning dharahara
Guess how many vaccines a one year old baby is given
Does the 180 day auto extension apply for TPS?
Another Song Playing In My Mind
Susta Susta Degree Maile REMIXED version
Elderly parents travelling to US (any suggestions besides Special Assistance)?
कल्लाई मुर्ख भन्या ?
Alert: Turbo Cancers: A Rising Global Threat
1974 AD Pinjadako Suga Remixed
जाडो, बा र म……
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters