Factorial of a Number Write a C++ Program to find Factorial of a number using class. int main() is provided, all you have to do is to create the class. Input 1. Number Output Enter a number: 5 The factorial of 5 is 120 main.cpp 1 #include 2 using namespace std; 3 5 int main() 7 factorial f; 8 f.input(); 9 f.calc(); 10 f.display(); 11 return 0; 12 }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question
100%

Please answer in C++ code only!

Factorial of a
Number
Write a C++ Program to find Factorial of a
number using class.
int main() is provided, all you have to do is
to create the class.
Input
1. Number
Output
Enter a number: 5
The factorial of 5 is 120
main.cpp
1 #include <iostream>
2 using namespace std;
3
4
5 int main()
6 {
7 factorial f;
8 f.input();
9 f.calc();
10
11
12 }
f.display();
return 0;
Transcribed Image Text:Factorial of a Number Write a C++ Program to find Factorial of a number using class. int main() is provided, all you have to do is to create the class. Input 1. Number Output Enter a number: 5 The factorial of 5 is 120 main.cpp 1 #include <iostream> 2 using namespace std; 3 4 5 int main() 6 { 7 factorial f; 8 f.input(); 9 f.calc(); 10 11 12 } f.display(); return 0;
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage