Help plzz
Printable View
Help plzz
This does not qualify as asking for help. Nobody has the time to go through your code and try to understand what the problem is. You need to be specific about what you need to do, what have you done so far and what you are having problems with
You declare home name as a global variable on line 40. You then redefine the variable elsewhere, which, according to the rules of scope, will cause the program to look at the name closest to the working code. The one with no information.
Delete the global so that you can use the other home name variables, and change your functions so that they return the variables they change. To do that you have to list the struct name before the function name, both in the prototype and definition. Read more here: Cprogramming.com Tutorial: Functions
There's also no reason to hide small programs in an attachment when you ask things about it:
Code:#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
struct home
{
char fullname[50], address[20];
int age;
};
struct fullinfo
{
struct home name;
};
void function(struct home name)
{
printf("Enter name:");
scanf("%s",&name.fullname);
printf("\nEnter address:");
scanf("%s",&name.address);
printf("\nEnter age:");
scanf("%d",&name.age);
}
void show(struct fullinfo bin)
{
struct home name;
printf("\nName:%s %s",bin.name.fullname);
printf("\nAddress:%s %s",bin.name.address);
printf("Age:%d %d",bin.name.age);
}
int rec( struct fullinfo bin, struct home name)
{
return (strcmp(name.fullname, bin.name.fullname)==0)
&& (strcmp(name.address, bin.name.address)==0)
&& (strcmp(name.age, bin.name.age)==0);
}
struct home name;
void show(struct fullinfo bin);
int rec( struct fullinfo bin, struct home name);
void main()
{
struct home name;
struct fullinfo bin;
int fin;
clrscr();
function(name);
show(bin);
printf("\n1. Edit\n2. Delete \n 3. Exit\n");
printf("Enter Here:");
scanf("%d",&fin);
switch(fin)
{
case 1:
{
function(name);
show(bin);
getch();
}
case 2:
{
printf("\nFullname:");
printf("\nAddress:");
printf("\nAge:");
exit(0);
}
case 3:
{
exit(0);
}
}
getch();
}
i cant get what you mean, sorry,
i just want to ask if anybody can edit my program so that i can get:
input:
name: andrew
address: jones
age: 24
show (output);
ask if want to be edit name/address/age:
if edit name;
name: miles
if edit address;
address: hideaway
if age;
age: 22
then show final output.>>>>
\thats all, i keep breaking some of my programs but i just cant do this
We're not here to do everything for you. And while someone apparently does have time to go through your code and to try to understand the problem -- we're just not here to do all the work for you. Generally the way this works is you explain specifically what you want to do and what you can't seem to do, and we work from there.
Quzah.