943,936 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 2764
  • C++ RSS
Dec 14th, 2005
0

plzz solve my problem

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sidrah is offline Offline
1 posts
since Nov 2005
Dec 14th, 2005
0

Re: plzz solve my problem

Use [code] [/code] tags.

#include<conio.c>
->
#include<conio.h>
Reputation Points: 185
Solved Threads: 28
Posting Whiz in Training
dwks is offline Offline
269 posts
since Nov 2005
Dec 14th, 2005
0

Re: plzz solve my problem

C++ Syntax (Toggle Plain Text)
  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
C++ Syntax (Toggle Plain Text)
  1. int Power(int time1, int time2)
Reputation Points: 185
Solved Threads: 28
Posting Whiz in Training
dwks is offline Offline
269 posts
since Nov 2005
Feb 10th, 2009
-2

Re: plzz solve my problem

#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();
}
Reputation Points: 2
Solved Threads: 0
Newbie Poster
suman680 is offline Offline
1 posts
since Feb 2009
Feb 10th, 2009
0

Re: plzz solve my problem

include <math.h>

done == yes
Last edited by Mike Savino; Feb 10th, 2009 at 10:39 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mike Savino is offline Offline
2 posts
since Feb 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Little help with creating a C++ password function
Next Thread in C++ Forum Timeline: Classes and read and print functions





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC