0% found this document useful (0 votes)
25 views2 pages

Assignment No.4

The document describes an assignment to create two files, one containing a structure called factorial that calculates the factorial and sum of a number input by the user, and another file that includes the first file and uses the factorial structure to output the calculations.

Uploaded by

Danish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

Assignment No.4

The document describes an assignment to create two files, one containing a structure called factorial that calculates the factorial and sum of a number input by the user, and another file that includes the first file and uses the factorial structure to output the calculations.

Uploaded by

Danish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Name: M.

Bashar Program: ADP – CS


Roll no: 003 Semester: 2nd -Blue
Course: OOP Instructor: Sir Faheem

ASSIGNMENT # 04
File name: Momin.h
Input:
#include<iostream>

using namespace std;

struct factorial

int f,c,n;

void fact()

f=1 , c=0 ;

cout<<”Enter any number: ”;

cin>>n;

for(int i=n; i>=1; i--)

f=f*i;

for(int j=n; j>=1; j--)

c=c+j;

cout<<”The factorial of ”<<n<<” is ”<<f<<”\n”;

cout<<”The addition of ”<<n<<” is ”<<c<<”\n”;

};
Second file:
Input:
#include<iostream>

#include” Momin.h ”

using namespace std;

class calculus

public:

factorial f;

calculus()

f.fact:

};

main()

{
calculus c;

Outputs:

You might also like