can someone teach me how to use pointer in this program??
i dont know if what i did in this program is correct. can you tell me how to use pointers here.thanks!
#include<stdio.h>
#include<iostream.h>
struct fruits
{
int apple;
int banana;
int orange;
int jackfruit;
} fruit;
int shape;
int color;
int texture;
void main()
{
struct fruits *pfruit;
pfruit=&fruit;
cout<<"Enter the number of your choice for shape: [0] round/ [1] oblong"<<endl;
cin>>inputFruits();
cout<<"Enter the number of your choice for color: [0] green/ [1] yellow/ [2] red/ [3] orange"<<endl;
cin>>inputFruits();
cout<<"Enter the number of your choice for texture: [0] smooth/ [1] rough"<<endl;
cin>>inputFruits();
}
void inputFruits(struct fruits *pfruit)
{
if(shape==0)
{
cout<<"round"<<endl;
cin>>shape;
}
else
{
cout<<"oblong"<<endl;
cin>>shape;
}
if(color==0)
{
cout<<"green"<<endl;
cin>>color;
}
if(color==1)
{
cout<<"yellow"<<endl;
cin>>color;
}
if(color==2)
{
cout<<"red"<<endl;
cin>>color;
}
if(color==3)
{
cout<<"orange"<<endl;
cin>>color;
}
if(texture==0)
{
cout<<"smooth"<<endl;
cin>>texture;
}
else
{
cout<<"rough"<<endl;
cin>>texture;
}
}
void identifyFruits(struct fruits *pfruit)
{
if(shape==0)
{
if(color==2)
{
if(texture==0)
{
cout<<"Apple"<<endl;
cin>>pfruit->apple;
}}}
if(shape==1)
{
if(color==1)
{
if(texture==0)
{
cout<<"Banana"<<endl;
cin>>pfruit->banana;
}}}
if(shape==0)
{
if(color==3)
{
if(texture==0)
{
cout<<"Orange"<<endl;
cin>>pfruit->orange;
}}}
if(shape==1)
{
if(color==0)
{
if(texture==1)
{
cout<<"Jackfruit"<<endl;
cin>>pfruit->jackfruit;
}}}
}