[VIEWED 4808
TIMES]
|
SAVE! for ease of future access.
|
|
|
Udeshya
Please log in to subscribe to Udeshya's postings.
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
|
|
|
|
mulmiz
Please log in to subscribe to mulmiz's postings.
Posted on 02-22-12 12:26
PM [Snapshot: 107]
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
|
|
Udeshya
Please log in to subscribe to Udeshya's postings.
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.
|
|
|
Udeshya
Please log in to subscribe to Udeshya's postings.
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.
|
|
|
serial
Please log in to subscribe to serial's postings.
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
|
|
|
serial
Please log in to subscribe to serial's postings.
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;
}
|
|
|
Udeshya
Please log in to subscribe to Udeshya's postings.
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.
|
|