/*
program-1
#include<iostream>
using namespace std;
int main()
{
int n,a=1,s=0;
cout<<"emter range : ";
cin>>n;
for(int i=0;i<n;i++)
{
s+=a;
a++;
}
cout<<"sum ="<<s;
}
*/
/*
program-2
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"emter a number : ";
cin>>n;
int f=1;
if (n==0 || n==1)
cout<<"factorial is 1";
else
for(int i=1;i<=n;i++)
{
f=f*i;
}
cout<<"factorial = "<<f;
}
*/
/*
program-3
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int n;
cout<<"enter range : ";
cin>>n;
int a=0,b=1,c;
cout<<a<<" "<<b<<" " ;
for(int i=2;i<n;i++)
{
c=a+b;
a=b;
b=c;
cout<<c<<" ";
}
/*
prigram-4
#include<iostream>
using namespace std;
int main()
{
int n=0;
cout<<"enter number : ";
cin>>n;
for(int i=1;i<=n;i++)
{
if(n%i==0)
cout<<i<<"-->is factor of "<<n<<endl;
}
*/
/*
program-5
#include<iostream>
using namespace std;
int main()
{
int n,c=0;
cout<<"enter number : ";
cin>>n;
for(int i=1;i<=n;i++)
{
if(n%i==0)
c++;
//cout<<i<<"-->is factor of "<<n<<endl;
}
if(c==2)
cout<<n<<"-->is a prime number..";
else
cout<<n<<"-->is not a prime number..";
}
*/
/*
program-6
#include<iostream>
using namespace std;
int main()
{
int n,r=0,d,m;
cout<<"enter the number : ";
cin>>n;
m=n;
while(m>0)
{
d=m%10;
r=r*10+d;
m/=10;
}
if(n==r)
cout<<n<<"-->is a palindrome..";
else
cout<<n<<"-->is not a palindrome..";
}
*/
/*
PROGRAM-8
#include<iostream>
using namespace std;
int main()
{
int n,r=0,d,m;
cout<<"enter the number : ";
cin>>n;
m=n;
while(m>0)
{
d=m%10;
r=r*10+d;
m/=10;
}
cout<<"the reverse of number "<<n<<" is "<<r;
}
*/
/*
PROGRAM-10
#include<iostream>
using namespace std;
int main()
{
int a=0,n;
cout<<"enter range : ";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<a++<<" ";
}
*/
/*
PROGRAM-7
#include<iostream>
using namespace std;
class Test
{
public:
int n;
void test()
{
cout<<"enter a number : ";
cin>>n;
}
void display()
{
if(n%2==0)
cout<<n<<"--> is an even number..";
else
cout<<n<<"--> is an odd number..";
}
};
int main()
{
Test tt;
[Link]();
[Link]();
}
*/
/*
PROGRAM--10
#include<iostream>
using namespace std;
class student
{
public:
int id;
string name;
void get()
{
cout<<"enter your name : ";
cin>>name;
cout<<"enter your id : ";
cin>>id;
}
};
class display : public student
{
public:
void put()
{
cout<<"name of student -->> "<<name<<endl;
cout<<"id no of student -->> "<<id<<endl;
}
};
int main()
{
display stu;
[Link]();
[Link]();
return 0;
}
*/
/*
PROGRAM--11
#include<iostream>
using namespace std;
class Length
{
public:
int len;
void getl()
{
cout<<"enter length : ";
cin>>len;
}
};
class Width : public Length
{
public:
int width;
void getw()
{
cout<<"enter width : ";
cin>>width;
}
};
class Area : public Width
{
public:
int area;
void get_area()
{
area=len*width;
cout<<"Area is -->> "<<area<<endl;
}
};
int main()
{
Area a;
[Link]();
[Link]();
a.get_area();
return 0;
}
*/
/*
APPEND PROGRAM--UNIT6
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream fout;
char ch;
string line;
[Link]("[Link]",ios::app|ios::in);
if(fout.is_open())
{
cout<< "enter a line"<<endl;
getline(cin, line);
fout << line << endl;
[Link](0,ios::beg);
while(fout)
{
getline(fout,line);
cout<<line<<endl;
}
[Link]();
else
cout<<"unabel to open file...";
return 0;
}
*/
/*
UNIT6--READ PROGRAM
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
string line;
ifstream myfile("[Link]");
if(myfile.is_open())
{
while(getline(myfile,line));
{
cout<<line<<"\n";
}
}
else
cout<<"unable to open file..";
*/
/*
PROGRAM--UNIT5
#include <iostream>
using namespace std;
template<class T1, class T2>
class sum
{
T1 a;
T2 b;
public:
sum(T1 x,T2 y)
{
a = x;
b = y;
}
void display()
{
cout << "Sum of two numbers a+b --> "<<a+b<<'\n';
}
};
int main()
{
sum<int,float> d(5,6.5);
[Link]();
return 0;
}
*/
/*
PROGRAM--UNIT5
#include <iostream>
using namespace std;
template<class X,class Y> void max(X a,Y b)
{
cout << "Value of a is : " <<a<< endl;
cout << "Value of b is : " <<b<< endl;
if(a>b)
{
cout<<a<<"->is maximum number..";
}
else
cout<<b<<"-->is maximum number..";
}
int main()
{
max(15,12.3);
return 0;
}
*/
//UNIT--6
// #include<iostream>
// #include<fstream>
// #include<string>
// int main()
// {
// std::ifstream file("[Link]");
// if(file)
// {
// std::cerr<<"Unable to open file.."<<std::endl;
// return 1;
// }
// int linecount = 0;
// int wordcount = 0;
// std::string line;
// while(std::getline(file,line))
// {
// ++linecount;
// std::istringstream iss(line);
// std::string word;
// while (iss>>word)
// {
// ++wordcount;
// }
// }
// [Link]();
// std::cout<<"[Link] lines --> "<<linecount<<std::endl;
// std::cout<<"[Link] words --> "<<wordcount<<std::endl;
// return 0;
// }