plzz solve my problem

Reply

Join Date: Nov 2005
Posts: 1
Reputation: sidrah is an unknown quantity at this point 
Solved Threads: 0
sidrah sidrah is offline Offline
Newbie Poster

plzz solve my problem

 
0
  #1
Dec 14th, 2005
Hye........
plzzz solve my problem my problem is that in this progamme
is runing but i dont understand that how in the end of the programme there is some thinds are missing that are
when programme finished then it print the
Thanks for using the program.
and this progamme is runinig in this way
for example
The program should also have a menu like.

Addition : A
Subtraction : S
Power : P
Factorial : F
Quit : Q

Please enter the option:

The program should repeat until the user wants to quit.

Sample Output



Please enter the first number: 11
Please enter the second number: 3

Addition : A
Subtraction : S
Power : P
Factorial : F
Quit : Q

Please enter the option: A

The Result after Addition is: 14

Do you want to continue? Y
//After clearing the text window
Addition : A
Subtraction : S
Power : P
Factorial : F
Quit : Q


Please enter the option: S

The Result after Subtraction is: 8
Do you want to continue? Y
//After clearing the text window
Addition : A
Subtraction : S
Power : P
Factorial : F
Quit : Q

Please enter the option: P

The Result after taking Power is: 1331

Do you want to continue? Y
//After clearing the text window
Addition : A
Subtraction : S
Power : P
Factorial : F
Quit : Q


Please enter the option: Q

Thanks for using the program.



but that i have make it but there is many problems
plzzzzzzzz can u help me in this problem
BYE take crae
bye

THE ORGRAMME IS


  1. #include<iostream.h>
  2. #include<conio.c>
  3.  
  4. char choice;
  5. int time1;
  6. int time2;
  7. char cnt;
  8. int result;
  9. //**********************************************************
  10. int Power(int time1, int time2)
  11. {
  12. int exponentResult=1;
  13. for(int i=0 ; i<time2 ; i++)
  14. exponentResult=time1 * exponentResult;
  15. return exponentResult;
  16. }
  17. //***************************************************************
  18. void Factorial(int time1, int* factorialResult)
  19. {
  20. *factorialResult=1;
  21. for(int i=time1 ; i>0 ; i--)
  22. *factorialResult=*factorialResult * i;
  23. }
  24. /******************************************************************/
  25. int sum (int time1, int time2)
  26. {
  27. int sum;
  28. sum = time1 + time2;
  29. return sum;
  30. }
  31. /******************************************************************/
  32. int multiply(int time1, int time2)
  33. {
  34. int multy;
  35. multy = time1 * time2;
  36. return multy;
  37. }
  38. /****************************************************/
  39. int main()
  40. {
  41. do
  42. {
  43. cout<<"\n Enter first number: ";
  44. cin>>time1;
  45. cout<<"\n Enter second number: ";
  46. cin>>time2;
  47. cout<<"\n\tEnter S for Sum\n";
  48. cout<<"\tEnter V to find power\n";
  49. cout<<"\tEnter A to Multiply\n";
  50. cout<<"\tEnter F for the factorials\n";
  51. cout<<"\tEnter Q to Quit\n";
  52. cout<<"\n\tPlease enter the option: ";
  53. cin>>choice;
  54. switch (choice)
  55. {
  56. case 's':
  57. cout<<" Result after addition is : "<<sum(time1, time2)<<endl;
  58. break;
  59. case 'a':
  60. cout<<" Result of Multiply first & second : "<<multiply(time1, time2)<<endl;
  61. break;
  62. case 'v':
  63. cout<<" Result of power integers is : "<<Power(time1,time2)<<endl;
  64. break;
  65. case 'f':
  66. Factorial(time1,&result);
  67. cout<<endl<<"The result of factorail of first number is : "<<result;
  68. Factorial(time2,&result);
  69. cout<<endl<<"The result of factorail of Second number is : "<<result;
  70. break;
  71. case 'q':
  72. exit(0);
  73. break;
  74. if(choice == 's' || choice == 'v' || choice == 'a' || choice == 'f' || choice == 'q')
  75.  
  76. default:
  77. cout<<"\nwrong choice entered\n";
  78. break;
  79. }
  80. cout<<"\nDo you want to continue? Y: ";
  81. cin>>cnt;
  82. }
  83. while(cnt == 'y');
  84. clrscr();
  85. getch();
  86. }
Last edited by Ancient Dragon; Feb 11th, 2009 at 3:20 pm. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 251
Reputation: dwks has a spectacular aura about dwks has a spectacular aura about 
Solved Threads: 25
dwks's Avatar
dwks dwks is offline Offline
Posting Whiz in Training

Re: plzz solve my problem

 
0
  #2
Dec 14th, 2005
Use [code] [/code] tags.

#include<conio.c>
->
#include<conio.h>
dwk

Seek and ye shall find.

"Only those who will risk going too far can possibly find out how far one can go."
-- TS Eliot.

"I have not failed. I've just found 10,000 ways that won't work."
-- Thomas Alva Edison

"The only real mistake is the one from which we learn nothing."
-- John Powell
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 251
Reputation: dwks has a spectacular aura about dwks has a spectacular aura about 
Solved Threads: 25
dwks's Avatar
dwks dwks is offline Offline
Posting Whiz in Training

Re: plzz solve my problem

 
0
  #3
Dec 14th, 2005
  1. if(choice == 's' || choice == 'v' || choice == 'a' || choice == 'f' || choice == 'q')
  2.  
  3. default:
  4. cout<<"\nwrong choice entered\n";
  5. break;
What are you trying to do there?

BTW, the standard C function pow() is pretty much the same as
  1. int Power(int time1, int time2)
dwk

Seek and ye shall find.

"Only those who will risk going too far can possibly find out how far one can go."
-- TS Eliot.

"I have not failed. I've just found 10,000 ways that won't work."
-- Thomas Alva Edison

"The only real mistake is the one from which we learn nothing."
-- John Powell
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1
Reputation: suman680 has a little shameless behaviour in the past 
Solved Threads: 0
suman680 suman680 is offline Offline
Newbie Poster

Re: plzz solve my problem

 
-2
  #4
Feb 10th, 2009
#include<stdio.h>
#include<conio.h>
void main()
{
int A,S,a,b;
long int F=1;
clrscr();
printf("enter two number");
scanf("%d%d",&a,&b);
A=a+b;
printf("\nA=%d",A);
S=a-b;
printf("\nS=%d",S);
for(i=1;i<=a;i++)
{
F=F*i;
}
printf("\nthe factorial first number F(a)=%ld",F);

for(i=1;i<=b;i++)
{
F=F*i;
}
printf("\nthe factorial of second number F(b)=%ld",F);
getch();
}
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 2
Reputation: Mike Savino is an unknown quantity at this point 
Solved Threads: 0
Mike Savino Mike Savino is offline Offline
Newbie Poster

Re: plzz solve my problem

 
0
  #5
Feb 10th, 2009
include <math.h>

done == yes
Last edited by Mike Savino; Feb 10th, 2009 at 10:39 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC