SlideShare a Scribd company logo
1 of 5
#include<stdio.h>
#include<stdlib.h>
void figureWinnings(int betamount,int option,int number,int
evenodd,int dozenoption);
int
option=0,number=0,evenodd=0,even=0,odd=0,dozenoption=0;
void showInstructions();
int getBetamount();
void makeBet();
figureWinnings(betamount,option,number,evenodd,dozenoption)
;
int main()
{
//Decaring Variable.
int betAmt, winamt;
//This while loop continue to iterate until user stops keeping
bet by pressing 'n' or 'N'.
while(1)
{
char rg;
showInstructions();
int getBetamount();
makeBet();
betAmt = getBetamount();
printf(" Do You want to continue (y/n):");
scanf("%c",&rg);
if(rg=='y'||rg=='Y')
{
continue;
}else
{
break;
}
}
return 0;
}
void showInstructions()
{
printf(" ");
printf(" Bet On a Number ,Payout is 36 times the bet
Amount");
printf(" Bet On Even Or odd Number ,Payout is 2 times the
bet Amount");
printf(" Bet On a Dozen,first (1-12),second (13-24),third
(25,36) , Payout is 3 times the bet Amount");
printf(" ");
}
int getBetamount()
{
int betAmt;
printf(" Enter the Bet amount:");
scanf("%d",&betAmt);
return betAmt;
}
void makeBet()
{
printf(" Which type of bet would you like to place?");
printf(" 1.Number");
printf(" 2.Even (or) Odd");
printf(" 3.Dozen ");
scanf("%d",&option);
if(option==1)
{
printf(" Enter the number on which you want to keep bet::");
scanf("%d",&number);
}
else if(option==2)
{
printf(" Do you want to bet on even (Or) odd Number ?");
printf(" 4.Even");
printf(" 5.Odd ");
scanf("%d",&evenodd);
}
else if(option==3)
{
printf(" On which dozen you want to bet on ?");
printf(" 6.(1-12)");
printf(" 7.(13-24)");
printf(" 8.(25-36) ");
scanf("%d",&dozenoption);
}
}
int spinWheel()
{
randnum=rand() % 37;
return randnum;
}
void figureWinnings(int betamount,int option,int number,int
evenodd,int dozenoption)
{
if(randnum>=1 && randnum<=36 && randnum==number &&
option>=1 && option<=3)
{
winamt=betamount*36;
printf("The Winamount ::%d",winamt);
}
else if((randnum%2==0 && evenodd==4)|| (randnum%2!=0 &&
evenodd==5) )
{
winamt=betamount*2;
printf("The Winamount ::%d",winamt);
}
else if((randnum>=1 && randnum<=12 &&
dozenoption==6)||(randnum>=13 && randnum<=24 &&
dozenoption==7)||(randnum>=25 && randnum<=36 &&
dozenoption==8))
{
winamt=betamount*3;
printf("The Winamount ::%d",winamt);
}
else
{
printf(":: You Lost the bet ::");
}
}
can someone help me whys it saying winamt not declared and
randnum not declared?/
Solution
The winamt and randnum assigend direct to the function calls
which are declared as globally. when the global function starts
it's execution the life span of the variables available through
out the program. But here we declare winamt and randamt with
in the function. Here these two variables available only with in
that block.these two variables doesn't available through out the
program. Hence it shows compilation error these two are not
declared.

More Related Content

Similar to #includestdio.h #includestdlib.hvoid figureWinnings(int beta.docx

Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
alish sha
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 
import java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdfimport java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdf
anwarsadath111
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
Er Ritu Aggarwal
 

Similar to #includestdio.h #includestdlib.hvoid figureWinnings(int beta.docx (19)

Bti1022 lab sheet 8
Bti1022 lab sheet 8Bti1022 lab sheet 8
Bti1022 lab sheet 8
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
 
Dvst
DvstDvst
Dvst
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
06 1 조건문
06 1 조건문06 1 조건문
06 1 조건문
 
Complier File
Complier FileComplier File
Complier File
 
Write a program to check a given number is prime or not
Write a program to check a given number is prime or notWrite a program to check a given number is prime or not
Write a program to check a given number is prime or not
 
import java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdfimport java.util.Scanner;public class Main {    public static in.pdf
import java.util.Scanner;public class Main {    public static in.pdf
 
C Programming Lab.pdf
C Programming Lab.pdfC Programming Lab.pdf
C Programming Lab.pdf
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
SaraPIC
SaraPICSaraPIC
SaraPIC
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
Decision making and branching
Decision making and branchingDecision making and branching
Decision making and branching
 
Vcs5
Vcs5Vcs5
Vcs5
 
Arrays
ArraysArrays
Arrays
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
Vcs4
Vcs4Vcs4
Vcs4
 
5 c control statements looping
5  c control statements looping5  c control statements looping
5 c control statements looping
 

More from ajoy21

Please choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docxPlease choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docx
ajoy21
 
Please answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docxPlease answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docx
ajoy21
 
Please answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docxPlease answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docx
ajoy21
 
Please answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docxPlease answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docx
ajoy21
 

More from ajoy21 (20)

Please complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docxPlease complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docx
 
Please cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docxPlease cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docx
 
Please choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docxPlease choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docx
 
Please check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docxPlease check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docx
 
Please answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docxPlease answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docx
 
Please attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docxPlease attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docx
 
Please answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docxPlease answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docx
 
Please answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docxPlease answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docx
 
Please answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docxPlease answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docx
 
Please answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docxPlease answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docx
 
Please answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docxPlease answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docx
 
Please answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docxPlease answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docx
 
Please answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docxPlease answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docx
 
Please answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docxPlease answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docx
 
Please answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docxPlease answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docx
 
Please answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docxPlease answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docx
 
Please answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docxPlease answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docx
 
Please answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docxPlease answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docx
 
Please answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docxPlease answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docx
 
Please answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docxPlease answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docx
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 

#includestdio.h #includestdlib.hvoid figureWinnings(int beta.docx

  • 1. #include<stdio.h> #include<stdlib.h> void figureWinnings(int betamount,int option,int number,int evenodd,int dozenoption); int option=0,number=0,evenodd=0,even=0,odd=0,dozenoption=0; void showInstructions(); int getBetamount(); void makeBet(); figureWinnings(betamount,option,number,evenodd,dozenoption) ; int main() { //Decaring Variable. int betAmt, winamt; //This while loop continue to iterate until user stops keeping bet by pressing 'n' or 'N'. while(1) { char rg; showInstructions(); int getBetamount(); makeBet(); betAmt = getBetamount(); printf(" Do You want to continue (y/n):"); scanf("%c",&rg); if(rg=='y'||rg=='Y') { continue; }else { break; } }
  • 2. return 0; } void showInstructions() { printf(" "); printf(" Bet On a Number ,Payout is 36 times the bet Amount"); printf(" Bet On Even Or odd Number ,Payout is 2 times the bet Amount"); printf(" Bet On a Dozen,first (1-12),second (13-24),third (25,36) , Payout is 3 times the bet Amount"); printf(" "); } int getBetamount() { int betAmt; printf(" Enter the Bet amount:"); scanf("%d",&betAmt); return betAmt; } void makeBet() { printf(" Which type of bet would you like to place?"); printf(" 1.Number"); printf(" 2.Even (or) Odd"); printf(" 3.Dozen "); scanf("%d",&option); if(option==1) { printf(" Enter the number on which you want to keep bet::"); scanf("%d",&number); } else if(option==2)
  • 3. { printf(" Do you want to bet on even (Or) odd Number ?"); printf(" 4.Even"); printf(" 5.Odd "); scanf("%d",&evenodd); } else if(option==3) { printf(" On which dozen you want to bet on ?"); printf(" 6.(1-12)"); printf(" 7.(13-24)"); printf(" 8.(25-36) "); scanf("%d",&dozenoption); } } int spinWheel() { randnum=rand() % 37; return randnum; } void figureWinnings(int betamount,int option,int number,int evenodd,int dozenoption) { if(randnum>=1 && randnum<=36 && randnum==number && option>=1 && option<=3) { winamt=betamount*36; printf("The Winamount ::%d",winamt); } else if((randnum%2==0 && evenodd==4)|| (randnum%2!=0 && evenodd==5) ) { winamt=betamount*2; printf("The Winamount ::%d",winamt);
  • 4. } else if((randnum>=1 && randnum<=12 && dozenoption==6)||(randnum>=13 && randnum<=24 && dozenoption==7)||(randnum>=25 && randnum<=36 && dozenoption==8)) { winamt=betamount*3; printf("The Winamount ::%d",winamt); } else { printf(":: You Lost the bet ::"); } } can someone help me whys it saying winamt not declared and randnum not declared?/ Solution The winamt and randnum assigend direct to the function calls which are declared as globally. when the global function starts it's execution the life span of the variables available through out the program. But here we declare winamt and randamt with in the function. Here these two variables available only with in that block.these two variables doesn't available through out the program. Hence it shows compilation error these two are not