#include<iostream>
usingnamespace std;
shortunsignedint choice = 0;
shortunsignedint sss = 0;
void breakfast();
void lunch();
void snack();
void dinner();
void desert();
int main()
{
char answer;
shortunsignedint i = 0;
cout<<"yes or no"<<endl;
cin>>answer;
if (answer = 'y')
{
i = (i + 1);
}
else
{
i = (i + 2);
}
cout<<"yes or no"<<endl;
cin>>answer;
if (answer = 'y')
{
i = (i + 1);
}
else
{
i = (i + 2);
}
cout<<i;
}
ignore those prototypes i just want to know how to pass down i? i mean if my first answer is y and my second answer is n, i want the cout to be 3 which is 1+2 but it is displaying 2 instead.
Actually i want that pass down thing to have global effect. E.g the code i have in main will be in one of the functions i call the function in main then display i.