Sample Code

// ببِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
/*
───────────────────────────────────────────────────────────────────────────────────────────────────────────
─████████████████───██████████████─████████──████████─██████──██████─██████████████─██████──────────██████─
─██░░░░░░░░░░░░██───██░░░░░░░░░░██─██░░░░██──██░░░░██─██░░██──██░░██─██░░░░░░░░░░██─██░░██████████──██░░██─
─██░░████████░░██───██░░██████░░██─████░░██──██░░████─██░░██──██░░██─██░░██████░░██─██░░░░░░░░░░██──██░░██─
─██░░██────██░░██───██░░██──██░░██───██░░░░██░░░░██───██░░██──██░░██─██░░██──██░░██─██░░██████░░██──██░░██─
─██░░████████░░██───██░░██████░░██───████░░░░░░████───██░░██████░░██─██░░██████░░██─██░░██──██░░██──██░░██─
─██░░░░░░░░░░░░██───██░░░░░░░░░░██─────████░░████─────██░░░░░░░░░░██─██░░░░░░░░░░██─██░░██──██░░██──██░░██─
─██░░██████░░████───██░░██████░░██───────██░░██───────██░░██████░░██─██░░██████░░██─██░░██──██░░██──██░░██─
─██░░██──██░░██─────██░░██──██░░██───────██░░██───────██░░██──██░░██─██░░██──██░░██─██░░██──██░░██████░░██─
─██░░██──██░░██████─██░░██──██░░██───────██░░██───────██░░██──██░░██─██░░██──██░░██─██░░██──██░░░░░░░░░░██─
─██░░██──██░░░░░░██─██░░██──██░░██───────██░░██───────██░░██──██░░██─██░░██──██░░██─██░░██──██████████░░██─
─██████──██████████─██████──██████───────██████───────██████──██████─██████──██████─██████──────────██████─
───────────────────────────────────────────────────────────────────────────────────────────────────────────

Search In Google rayhan50001 or rayhan5000 you can Find all information about me
Bangladesh University of Business & Technology(BUBT)
CSE,29th Intake,Section-05
*/
//*If You Have a Good Personality,You Don’t Need To Describe Yourself*\\

#include

using namespace std;

#define SET(a) memset(a,-1,sizeof(a))
#define ALL(a) a.begin(),a.end()
#define SZ(A) A.size()
#define CLR(a) memset(a,0,sizeof(a))
#define PB push_back
#define PI acos(-1.0)
#define MP(a,b) make_pair(a,b)
#define PII pair
#define PCC pair
#define PIC pair
#define PCI pair
#define VS vector
#define VI vector
#define SC vector
#define SS set
#define SI set
#define SC set
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define READ freopen(“input.txt”, “r”, stdin)
#define WRITE freopen(“output.txt”, “w”, stdout)
#define LL long long
#define FOR(i,a,b) for(int i=a;i=b;i–)
#define For(i,a) for(int i=0;i<a;i++)

#define S(a) scanf("%d",&a)
#define S2(a,b) scanf("%d%d",&a,&b)
#define S3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define SLL(a) scanf("%lld",&a)
#define SLL2(a,b) scanf("%lld%lld",&a,&b)
#define SLL3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
//#define SS(a) scanf("%s",&a)
#define SC(a) scanf("%c",&a)
#define SD(a) scanf("%lf",&a)
#define P(a) printf("%d",a)
#define PLL(a) printf("%lld",a)
#define PD(a) printf("%lf",a)
#define PC(a) printf("%c",a)
#define PS(a) printf("%s",a)
#define KS printf("Case %d: ",kk++)
#define KN printf("Case %d:\n",kk++)
#define KH printf("Case #%d: ",kk++)
#define NL printf("\n")
#define DB cout<<"done"<<endl;
#define YES() cout<<"YES\n";
#define NO() cout<<"NO\n";
#define Yes() cout<<"Yes\n";
#define No() cout<<"No\n";
#define EPS 1e-9
#define MOD 1000000007
#define INF INT_MAX/3
#define MX 100010
#define DIST(x1,x2, y1, y2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)))
#define DIST3D(x1,x2, y1, y2, z1, z2) (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2)) + ((z1-z2)*(z1-z2)))
#define ansmax -9999999999999999999
templateinline string tostring(T a){ostringstream os("");os <>res;return res;}
templateinline VI parse(T str){VI res;int s;istringstream os(str);while(os>>s)res.PB(s);return res;}
template inline T _sqrt(T x) { return (T) sqrt( (double) x); }
template inline T _bigmod(T n,T m) {T ans=1,mult=n%MOD; while(m){ if(m & 1) ans=(ans*mult)%MOD; m>>=1; mult=(mult*mult)%MOD; } ans%=MOD; return ans;}
template inline T _modinv(T x) {return _bigmod(x,(T) MOD-2)%MOD;}
inline int LEN(string a) {return a.length();}
inline int LEN(char a[]) {return strlen(a);}
template inline T _gcd(T a, T b){return (b==0) ? a : _gcd(b, a % b);}
template inline T _lcm(T x,T y) { return x*y/_gcd(x,y);}

//set function to order a tree
//typedef treepbd_set;
//end set function to order a tree
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
bool compare(const pair&i, const pair&j)
{
return i.first > j.first;
}
int in_c() { int c; for (; (c = getchar()) <= ' '; ) { if (!~c) throw ~0; } return c; }
const int mx = 1e5 + 7;
int EQ(double d) {
if ( fabs(d) EPS ? 1 : -1 ;
}
//int n, ans = 0;
//string s[100009];
//vector r, b;
//
//int conv(string t)
//{
// int res = 0;
// for(int i = 0; i =0 && y>=0 && x return true;
else
return false;
}
int main()
{
clock_t begin = clock();
ios_base::sync_with_stdio(false);
cin.tie(NULL);

///your code goes here

///end here
clock_t end = clock();
double time_spent = (double)(end – begin) / CLOCKS_PER_SEC;
cerr<<"Running Time: "<<time_spent<<" Seconds"<<endl;
return 0;
}

POS (Parts Of Speech) Guide (Game) Using C++

#include<bits/stdc++.h>
#include iostream
#include windows.h
#include string.h
#include stdio.h
#include stdlib
#include graphics.h
using namespace std;
void colorPrint(int k)
{
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, k);
}
int question_set1(int n)
{
int cor=0,fal=0,total=0,a;
//EASY PORTION
if(n==1)
{
//1
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Noun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Louis\n2= Is\n3= A\n4= Football\n5= Player\n”;
cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//2
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Pronoun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= She\n2= And\n3= Her\n4= Mother\n5= Have\n6= A\n7= Very\n8= Close\n9= Relationship\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>9)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//3
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Hasib\n2= Is\n3= In\n4= The\n5= House\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//4
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= I\n2= Am\n3= Spartacus\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//5
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Rocks\n2= Are\n3= Hard\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//6
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adverb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= There\n2= was\n3= Never\n4= Any\n5= Food\n6= In\n7= The\n8= House\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>8)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//7
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Kamrul\n2= Is\n3= A\n4= Good\n5= Boy\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//8
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= That\n2= Must\n3= Be\n4= A\n5= Very\n6= Hot\n7= Fire\n”;
cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>7)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==6)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//9
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Interjection “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Hurrah!\n2= We\n3= Have\n4= Won\n5= The\n6= Game\n”;
cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>6)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//10
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= They\n2= Have\n3= Much\n4= Rice\n”;
cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>6)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
}
//NORMAL PORTION
else if(n==2)
{
//1
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= People\n2= learn\n3= From\n4= Their\n5= Mistakes\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//2
cout<<endl;
cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Mother\n2= Gave\n3= Me\n4= A\n5= Card\n6= For\n7= My\n8= Birthday\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>8)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//3
cout<<endl;
cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= The\n2= New\n3= Mail\n4= Carrier\n5= Finally\n6= Arrived\n”;cout<<“\t\t\t”; cin>>a;
cout<<endl; while(a>6)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//4
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adverb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Last\n2= Night,\n3= The\n4= Shone\n5= Brightly\n6= Over\n7= The\n8= Homes\n9= In\n10= My\n11= Neighborhood\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>11)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==5)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//5
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adverb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Neela\n2= Writes\n3=Slowly\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//6
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Few\n2= Candidates\n3= Were\n4= Selected\n5= For\n6= The\n7= Jobs\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>7)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//7
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= I\n2= Told\n3= Them\n4= To\n5= Come\n6= Here\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>6)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//8
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Pronoun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= she\n2= Is\n3= A\n4= Sleeping\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>4)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//9
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Conjunction “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= He\n2= Studied\n3= Hard\n4= And\n5= Passed\n6= The\n7= Examination\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>7)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//10
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= The\n2= Book\n3= Is\n4= On\n5= The\n6= Table\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>6)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
}
total=(cor-fal)*100;
//freopen(“output.txt”,”w”,stdout);
cout<<“\n\n\t\tCorrect Answer: “<<cor<<endl;
cout<<“\t\tWrong Answer: “<<fal<<endl;
return total;
}
//Question Set-2
int question_set2(int n)
{
int cor=0,fal=0,total=0,a;
//EASY PORTION
if(n==1)
{
//1
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Tuna’s\n2= Dog\n3= Ate\n4= My\n5= Copy\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//2
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Pronoun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Your\n2= Father\n3= Is\n4= A\n5= Teacher\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//3
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Conjunction “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= I\n2= Can\n3= Read\n4= And\n5= Write\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//4
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Noun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Nisha\n2= Is\n3= A\n4= Good\n5= Girl\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//5
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= I\n2= Read\n3= In\n4= The\n5= Morning\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//6
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= I\n2= Have\n3= A\n4= Red\n5= Pendrive\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//7
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= He\n2= Is\n3= A\n4= bad\n5= Boy\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//8
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adverb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= They\n2= Live\n3= There\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//9
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Each\n2= Can\n3= Do\n4= It\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>4)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//10
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Noun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Man\n2= Is\n3= Mortal\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
}
//NORMAL PORTION
else if(n==2)
{
//1
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Pronoun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Last\n2= Night,\n3= The\n4= Shone\n5= Brightly\n6= Over\n7= The\n8= Homes\n9= In\n10= My\n11= Neighborhood\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>11)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==10)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//2
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= There\n2= Was\n3= Never\n4= Any\n5= Food\n6= In\n7= The\n8= House\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>8)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==6)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//3
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Man\n2= Is\n3= Mortal\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//4
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Programmers\n2= Of\n3= 29th\n4= Intake\n5= Section\n6= 5\n7= Are\n8= Good\n9= Coder\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>9)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//5
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= The\n2= Book\n3= Is\n4= On\n5= The\n6= Table\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>6)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//6
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adverb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= There\n2= Was\n3= Never\n4= Any\n5= Food\n6= In\n7= The\n8= House\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>8)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//7
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= He\n2= Seemed\n3= Sorry\n4= Since\n5= He\n6= Almost\n8= Immediately\n9= Apologized\n10= To\n11= Us\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>11)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//8
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Interjection “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Oh!\n2= What\n3= A\n4= Beautiful\n5= Flower\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//9
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Few\n2= Candidates\n3= Were\n4= Selected\n5= For\n6= The\n7= Jobs\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>7)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//10
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Pronoun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= The\n2= Garden\n3= Is\n4= In\n5= Front\n6= of\n7= My\n8= House\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>8)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==7)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
}
//freopen(“output.txt”,”w”,stdout);
total=(cor-fal)*100;
cout<<“\n\n\t\tCorrect Answer: “<<cor<<endl;
cout<<“\t\tWrong Answer: “<<fal<<endl;
return total;
}
//Question Se-3
int question_set3(int n)
{
int cor=0,fal=0,total=0,a;
//EASY PORTION
if(n==1)
{
//1
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adverb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= There\n2= Was\n3= Never\n4= Any\n5= Food\n6= In\n7= The\n8= House\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>8)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//2
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Pronoun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= I\n2= Read\n3= In\n4= The\n5= Morning\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//3
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Pronoun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= They\n2= Live\n3= There\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//4
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Man\n2= Is\n3= Mortal\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//5
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Sugar\n2= Is\n3= Sweet\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//6
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= I\n2= Am\n3= Spartacus\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//7
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Noun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Rahim\n2= Can\n3= Do\n4= It\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>4)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//8
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Pronoun “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= We\n2= Have\n3= Won\n4= The\n5= Game\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//9
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adverb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= There\n2= Was\n3= Never\n4= Any\n5= Food\n6= In\n7= The\n8= House\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>8)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//10
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Many\n2= Man\n3= Attended\n4= In\n5= The\n6= Function\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>6)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
}
//NORMAL PORTION
else if(n==2)
{
//1
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Last\n2= Night,\n3= The\n4= Shone\n5= Brightly\n6= Over\n7= The\n8= Homes\n9= In\n10= My\n11= Neighborhood\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>11)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//2
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Conjunction “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Not\n2= Only\n3= Karim\n4= But\n5= Also\n6= His\n7= Brothers\n8= Have\n9= Done\n10= This\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>10)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//3
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Many\n2= Man\n3= Attended\n4= In\n5= The\n6= Function\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>6)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//4
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Adjective “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= I\n2= Am\n3= A\n4= Good\n5= Boy\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//5
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Verb “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= The\n2= New\n3= Mail\n4= Finally\n5= Arrived\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//6
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Interjection “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= Wow!\n2= The\n3= Girl\n4= is\n5= Look\n6= So\n8= Beautiful\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>8)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==1)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//7
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= He\n2= Seemed\n3= Sorry\n4= Since\n5= He\n6= Almost\n8= Immediately\n9= Apologized\n10= To\n11= Us\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>11)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==4)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//8
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= I\n2= Read\n3= In\n4= The\n5= Morning\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>5)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==3)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//9
cout<<“Is There Any Adverb In This Sentence?? Enter(1=Yes or 2=No)\n”;
cout<<” Mom wanted the answer, but we had had no reply from our daughter or son”<<endl;
cout<<“1= Yes\n2= No\n”; cin>>a;
cout<<endl<<endl; while(a>2)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==2)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
//10
cout<<endl;cout<<“Choose “;colorPrint(15);cout<<“Preposition “;colorPrint(11);cout<<“from given words???”<<endl;
cout<<“1= There\n2= Was\n3= Never\n4= Any\n5= Food\n6= In\n7= The\n8= House\n”;cout<<“\t\t\t”; cin>>a;cout<<endl; while(a>8)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>a;
}
if(a==6)
{
system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);system(“COLOR A2”);cor++;system(“COLOR 0B”);
}
else
{
system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);system(“COLOR 4C”);fal++;system(“COLOR 0B”);
}
}
total=(cor-fal)*100;
//freopen(“output.txt”,”w”,stdout);
cout<<“\t\tCorrect Answer: “<<cor<<endl;
cout<<“\t\tWrong Answer: “<<fal<<endl;
return total;
}
/*int question_set4(int n)
{
if(n==1){}
else if(n==2){}
else{}
}
int question_set5(int n)
{
if(n==1){}
else if(n==2){}
else{}
}
*/
int main()
{
time_t tim;
time_t star = 0;
time_t end = 0;
time_t elapsed = 0; //create variable of time_t
time(&tim);
int start,dif,p1=0,p2=0;
cout <<“\t\t\t\t\t\tCurrent Time:\n\t\t\t\t\t\t”<< ctime(&tim)<<endl<<endl;
star = time(NULL);
system(“COLOR FC”);
cout<<“\t\t\t###########################\t\t”<<endl<<endl;
cout<<“\t\t\t<###### POS GUIDE ######>\t\t\n”<<endl;
cout<<“\t\t\t###########################\t\t\n\n\n\n”;
system(“PAUSE”);
system(“cls”);
system(“COLOR 0B”);
cout<<“\n\n\n\n\t\t\t Enter your Choice\t\t”<<endl;
cout<<“\t\t\t|———————–|\t\t”<<endl;
cout<<“\t\t\t|\t1=Start Game \t|\t\t”<<endl;
cout<<“\t\t\t|\t2=Instructions \t|\t\t”<<endl;
cout<<“\t\t\t|\t3=Exit \t\t|\t\t”<<endl;
cout<<“\t\t\t|———————–|\t\t”<<endl; cin>>start;
while(start>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>start;
}
system(“cls”);
system(“color F0”);
cout<<“\n\n\n\t\t\t Please wait while loading\n\n”;
char f=177, g=219;
cout<<“\t\t\t\t”;
for (int i=0;i<=15;i++)
cout<<f;
cout<<“\r”;
cout<<“\t\t\t\t”;
for (int i=0;i<=15;i++)
{
cout<<g;
for (int j=0;j<=1e8;j++); //You can also use sleep function instead of for loop
}

system(“cls”);
system(“COLOR 0B”);
char a[100],b[100],c[100];
int x,i,j,l[100],le[100],y,z,len[100],k,q,r,s,t,sum=0,sum1=0,sum2=0,p=0,flag=0;
while(1)
{
if(start==1)
{
cout<<“\n\n”;
cout<<“\t\tYou Can Play Only Single or Dual Player\n”;
cout<<“\t\tHow many player want to play??”<<endl; cin>>x;
while(x>2)
{
cout<<“Wrong Choice\n”;
cout<<“You Can Play Only Single or Dual Player Not “<<x<<“\n”; cin>>x;
}
system(“cls”);
if(x==1)
{
cout<<“\n\n”;
cout<<“\tEnter Player Name: “; cin>>a;
system(“cls”);
cout<<“\n\n”;
colorPrint(14);
cout<<“\t\t\t+===============+\t\n”;
cout<<“\t\t\t|1=Easy\t\t|\t\n”;
cout<<“\t\t\t|2=Normal\t|\t\n”;
cout<<“\t\t\t+===============+\t\n”; colorPrint(11); cin>>dif;
while(dif>2)
{
cout<<“Wrong Choice\n”;
cout<<“You Can Choose From Given Numbers Not”<<dif<<“\n”; cin>>dif;
}
cout<<“\n\n”;
system(“cls”);
y=strlen(a);
for(i=0; i<y; i++)
{
sum+=a[i];
}
//cout<<“Player : “<<sum<<endl;
if(sum%3==0)
{
//cout<<“Q1″<<endl;
p=question_set1(dif);
flag=3;
}
else if(sum%3==1)
{
//cout<<“Q2″<<endl;
p=question_set2(dif);
flag=3;
}
else
{
// cout<<“Q3″<<endl;
p=question_set3(dif);
flag=3;
}
break;
}
else if(x==2)
{
cout<<“\n\n”;
//cout<<“CAPITAL LATTER IS BEST : “<<endl<<endl;
cout<<“\t\tEnter 1st Player Name :”; cin>>b;
cout<<“\n”;
cout<<“\t\tEnter 2nd Player Name :”; cin>>c;
z=strlen(b);
j=strlen(c);
system(“cls”);
for(i=0; i<z; i++)
{
sum1=sum1+b[i];
}
for(i=0; i<j; i++)
{
sum2=sum2+c[i];
}
//cout<<“Player 1: “<<sum1<<endl;
//cout<<“Player 2: “<<sum2<<endl;
cout<<“\n\n”<<b<<“‘s Turn–>\n\n”;
colorPrint(14);
cout<<“\t\t\t+===============+\t\n”;
cout<<“\t\t\t|1=Easy\t\t|\t\n”;
cout<<“\t\t\t|2=Normal\t|\t\n”;
cout<<“\t\t\t+===============+\t\n”; colorPrint(11); cin>>dif;
while(dif>2)
{
cout<<“Wrong Choice\n”;
cout<<“You Can Choose Given Numbers Not”<<dif<<“\n”; cin>>dif;
}
system(“cls”);
if(sum1%3==0)
{

p1=question_set1(dif);
flag=1;
}
else if(sum1%3==2)
{

p1=question_set2(dif);
flag=1;
}
else
{
p1=question_set3(dif);
flag=1;
}
cout<<c<<“‘s Turn—>\n”;
colorPrint(14);
cout<<“\t+===============+\t\n”;
cout<<“\t|1=Easy\t\t|\t\n”;
cout<<“\t|2=Normal\t|\t\n”;
cout<<“\t+===============+\t\n”; colorPrint(11); cin>>dif;
while(dif>2)
{
cout<<“Wrong Choice\n”;
cout<<“You Can Choose Given Numbers Not”<<dif<<“\n”; cin>>dif;
}
system(“cls”);
if(sum2%3==2)
{
p2=question_set1(dif);
flag=2;
}
else if(sum2%3==1)
{
p2=question_set2(dif);
flag=2;
}
else
{
p2=question_set3(dif);
flag=2;
}
if(flag==3)
{
cout<<“\t\tTotal Score: “<<p<<endl;
}
else if(flag==1)
{
cout<<“\t\tTotal Score: “<<p1<<endl;
}
else if(flag==2)
{
cout<<“\t\tTotal Score: “<<p2<<endl; } system(“PAUSE”); system(“cls”); if(p1>p2)
{
colorPrint(10);
cout<<“\n\t\t”<<b<<” Win \3\3\n”;
colorPrint(11);
}
else if(p1<p2)
{
colorPrint(10);
cout<<“\n\t\t”<<c<<” Win \3\3\n”;
colorPrint(11);
}
else if(p1==p2)
{
colorPrint(10);
cout<<“\n\t\tDRAW!!!!!!!\n”;
colorPrint(11);
}
}
break;
}
else if(start==2)
{
system(“cls”);
colorPrint(5);
cout<<“\n\n\t\t**Instruction**\t\t\n\n”;
cout<<“To Play This Game You Should Choose Your Answer enter answer Number,This Game will Improve Your ‘Parts of speech’ Skill”<<endl;
colorPrint(11);
break;
}
else
{
system(“cls”);
cout<<“\t\t\tThank You!!!\n”;
cout<<“\t\tHope You Will Play This Game Again\n”;
break;
}
}
end = time(NULL);
elapsed =abs( star – end);
cout<<“\n\t\tYou Played: “;colorPrint(15);cout<<elapsed;colorPrint(11);cout<<” Seconds”<<endl<<endl;
system(“PAUSE”);
system(“cls”);
int ctr;
cout<<“\t\tLets Try Again,Last Chance!!!\n”;
cout<<“\t\t\Do You Want To Play Again\n\t\t\t1: Yes\n\t\t\t2: No \n”; while(cin>>ctr)
{
if(ctr==2)
{
system(“cls”);
cout<<“\t\t\tThank You!!!\n”;
cout<<“\t\tHope You Will Play This Game Again\n”;
break;
}
system(“cls”);
time_t tim;
time_t star = 0;
time_t end = 0;
time_t elapsed = 0; //create variable of time_t
time(&tim);
int start,dif,p1=0,p2=0;
cout <<“\t\t\t\t\t\tCurrent Time:\n\t\t\t\t\t\t”<< ctime(&tim)<<endl<<endl;
star = time(NULL);
system(“COLOR FC”);
cout<<“\t\t\t###########################\t\t”<<endl<<endl;
cout<<“\t\t\t<###### POS GUIDE ######>\t\t\n”<<endl;
cout<<“\t\t\t###########################\t\t\n\n\n\n”;
system(“PAUSE”);
system(“cls”);
system(“COLOR 0B”);
cout<<“\n\n\n\n\t\t\t Enter your Choice\t\t”<<endl;
cout<<“\t\t\t|———————–|\t\t”<<endl;
cout<<“\t\t\t|\t1=Start Game \t|\t\t”<<endl;
cout<<“\t\t\t|\t2=Instructions \t|\t\t”<<endl;
cout<<“\t\t\t|\t3=Exit \t\t|\t\t”<<endl;
cout<<“\t\t\t|———————–|\t\t”<<endl; cin>>start;
while(start>3)
{
cout<<“Wrong Choice\n”;
cout<<“Enter Valid Number From Given Numbers\n”; cin>>start;
}
system(“cls”);
system(“color F0”);
cout<<“\n\n\n\t\t\t Please wait while loading\n\n”;
char f=177, g=219;
cout<<“\t\t\t\t”;
for (int i=0;i<=15;i++)
cout<<f;
cout<<“\r”;
cout<<“\t\t\t\t”;
for (int i=0;i<=15;i++)
{
cout<<g;
for (int j=0;j<=1e8;j++); //You can also use sleep function instead of for loop
}
system(“cls”);
system(“COLOR 0B”);
char a[100],b[100],c[100];
int x,i,j,l[100],le[100],y,z,len[100],k,q,r,s,t,sum=0,sum1=0,sum2=0,p=0,flag=0;
while(1)
{
if(start==1)
{
cout<<“\n\n”;
cout<<“\t\tSingle or Dual Player\n”;
cout<<“\t\tHow many player want to play??”<<endl; cin>>x;
while(x>2)
{
cout<<“Wrong Choice\n”;
cout<<“You Can Play Only Single or Dual Player Not “<<x<<“\n”; cin>>x;
}
system(“cls”);
if(x==1)
{
cout<<“\n\n”;
cout<<“\tEnter Player Name: “; cin>>a;
system(“cls”);
cout<<“\n\n”;
colorPrint(14);
cout<<“\t\t\t+===============+\t\n”;
cout<<“\t\t\t|1=Easy\t\t|\t\n”;
cout<<“\t\t\t|2=Normal\t|\t\n”;
cout<<“\t\t\t+===============+\t\n”; colorPrint(11); cin>>dif;
while(dif>2)
{
cout<<“Wrong Choice\n”;
cout<<“You Can Choose Given Numbers Not”<<dif<<“\n”; cin>>dif;
}
cout<<“\n\n”;
system(“cls”);
y=strlen(a);
for(i=0; i<y; i++)
{
sum+=a[i];
}
//cout<<“Player : “<<sum<<endl;
if(sum%3==0)
{
//cout<<“Q1″<<endl;
p=question_set1(dif);
flag=3;
}
else if(sum%3==1)
{
//cout<<“Q2″<<endl;
p=question_set2(dif);
flag=3;
}
else
{
// cout<<“Q3″<<endl;
p=question_set3(dif);
flag=3;
}
system(“cls”);
break;
}
else if(x==2)
{
cout<<“\n\n”;
//cout<<“CAPITAL LATTER IS BEST : “<<endl<<endl;
cout<<“\t\tEnter 1st Player Name :”; cin>>b;
cout<<“\n”;
cout<<“\t\tEnter 2nd Player Name :”; cin>>c;
z=strlen(b);
j=strlen(c);

for(i=0; i<z; i++)
{
sum1=sum1+b[i];
}
for(i=0; i<j; i++)
{
sum2=sum2+c[i];
}
//cout<<“Player 1: “<<sum1<<endl;
//cout<<“Player 2: “<<sum2<<endl;
system(“cls”);
cout<<“\n\n”<<b<<“‘s Turn–>\n\n”;
colorPrint(14);
cout<<“\t+===============+\t\n”;
cout<<“\t|1=Easy\t\t|\t\n”;
cout<<“\t|2=Normal\t|\t\n”;
cout<<“\t+===============+\t\n”; colorPrint(11); cin>>dif;
while(dif>2)
{
cout<<“Wrong Choice\n”;
cout<<“You Can Choose Given Numbers Not”<<dif<<“\n”; cin>>dif;
}
if(sum1%3==0)
{

p1=question_set1(dif);
flag=1;
}
else if(sum1%3==2)
{

p1=question_set2(dif);
flag=1;
}
else
{

p1=question_set3(dif);
flag=1;
}
system(“cls”);
cout<<c<<“‘s Turn—>\n”;
colorPrint(14);
cout<<“\t+===============+\t\n”;
cout<<“\t|1=Easy\t\t|\t\n”;
cout<<“\t|2=Normal\t|\t\n”;
cout<<“\t+===============+\t\n”; colorPrint(11); cin>>dif;
while(dif>2)
{
cout<<“Wrong Choice\n”;
cout<<“You Can Choose Given Numbers Not”<<dif<<“\n”; cin>>dif;
}
if(sum2%3==2)
{
p2=question_set1(dif);
flag=2;
}
else if(sum2%3==1)
{

p2=question_set2(dif);
flag=2;
}
else
{

p2=question_set3(dif);
flag=2;
}
system(“cls”);
if(flag==3)
{
cout<<“\t\tTotal Score: “<<p<<endl;
}
else if(flag==1)
{
cout<<“\t\tTotal Score: “<<p1<<endl;
}
else if(flag==2)
{
cout<<“\t\tTotal Score: “<<p2<<endl; } system(“PAUSE”); if(p1>p2)
{
colorPrint(10);
cout<<“\n\t\t”<<b<<” Win \3\3\n”;
colorPrint(11);
}
else if(p1<p2)
{
colorPrint(10);
cout<<“\n\t\t”<<c<<” Win \3\3\n”;
colorPrint(11);
}
else if(p1==p2)
{
colorPrint(10);
cout<<“\n\t\tDRAW!!!!!!!\n”;
colorPrint(11);
}
system(“cls”);
}
break;
}
else if(start==2)
{
system(“cls”);
colorPrint(5);
cout<<“\n\n\t\t**Instruction**\t\t\n\n”;
cout<<“To Play This Game You Should Choose Your Answer enter answer Number,This Game will Improve Your ‘Parts of speech’ Skill”<<endl;
colorPrint(11);
break;
}
else
{
system(“cls”);
cout<<“\t\t\tThank You!!!\n”;
cout<<“\t\tHope You Will Play This Game Again\n”;
break;
}
}
end = time(NULL);
elapsed =abs( star – end);
cout<<“\n\t\tYou Played: “;colorPrint(15);cout<<elapsed;colorPrint(11);cout<<” Sec”<<endl<<endl;
system(“PAUSE”);
system(“cls”);
cout<<“\t\tDo You Want To Play Again\n\t\t\t1: Yes\n\t\t\t2: No “;
}
return 0;
}

Valentine Special Using C++

#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main()
{
double x,y;
double size=10;
for (x=0;x<size;x++)
{
for (y=0;y<=4*size;y++)
{
system("COLOR FC");
double dist1 = sqrt( pow(x-size,2) + pow(y-size,2) );
double dist2 = sqrt( pow(x-size,2) + pow(y-3*size,2) );

if (dist1 < size + 0.5 || dist2 < size + 0.5 )
cout<<‘\3’;
else
cout<<” “;
}
cout<<endl;
}
for ( x=1;x<2*size;x++)
{
for(y=0;y<x;y++)
cout<<” “;
for (y=0; y<4*size + 1 – 2*x; y++)
cout<<‘\3’;
cout<<endl;
}
cout<<endl<<endl;
system(“PAUSE”);
return 0;
}

2D array (Primary Diagonal & Secondary Diagonal & Middle Number) summation Using C++


#include<bits/stdc++.h>
using namespace std;
#define MAX 500
int main()
{
int a[MAX][MAX],i,j,k,n,sum=0,sum1=0,sum2=0,w;
while(cout<<"\nEnter Size NxN: ",cin>>n){
for(i=1; i<=n; i++)
{
for(j=1; j<=n; j++) { cin>>a[i][j];
}
}
cout<<"\nEnter 1 for Primary Diagonal Summation\nEnter 2 for Secondary Diagonal Summation\nEnter 3 for Middle Number summation\n"; cin>>w;
if(w==1)
{
for(i=1; i<=n; i++)
{
for(j=1; j<=n; j++)
{
if(i==j || j==i)
{
sum+=a[i][j];
}
}
}
}
else if(w==2){
for(i=1; i<=n; i++)
{
for(j=1; j<=n; j++)
{
if(j==n-i+1 || i==n-j+1)
{
sum1+=a[i][j];
}
}
}
}
else if(w==3){
for(i=2; i<=n-1; i++)
{
for(j=2; j<=n-1; j++)
{
sum2+=a[i][j];
}
}
}
cout<<endl;
if(w==1)
cout<<"\nSummation of Primary Diagonal: "<<sum;
if(w==2)
cout<<"\nSummation of Secondary Diagonal: "<<sum1;
if(w==3)
cout<<"\nSummation of Middle: "<<sum2;
cout<<endl;
}
return 0;
}

Caesar cipher (Encryption & Decryption) Using File with Class


#include<bits/stdc++.h>
#include <fstream>

#include <string.h>

using namespace std;
class Caesar
{
public: void encrypt(char *inp,char *out,int k);
void decrypt(char *inp,char *out,int k);
void readText(char *inp);
// void filter_blank_spaces(char *inp,char *output);
};
void Caesar::decrypt(char *inp,char *out,int k)
{
ifstream input;
ofstream output;
char l[10000],s[10000];
string line;
output.open(inp);

if(input.is_open())
{
getline(input,line);
input.close();
}

int n=line.length();
int c;
for(int i=0; i<n; i++)
{
l[i]=line[i];
}
for(int i=0;i<n;i++)
{
if(l[i]<=90 && l[i]>=65)
{
c=l[i]-k;
while(c<65)
{
c=65-c;
c=91-c;
}
s[i]=c;
output<<s[i]; } if(l[i]>=97 && l[i]<=122)
{
c=l[i]-k;
while(c<97)
{
c=97-c;
c=123-c;;
}
s[i]=c;
output<<s[i]; } if(l[i]>=48 && l[i]<=57)
{
c=l[i]-k;
while(c<48)
{
c=48-c;
c=58-c;;
}
s[i]=c;
output<<s[i]; } if(l[i]>=0 && l[i]<=47 || l[i]>=58 && l[i]<=64 || l[i]>=91 && l[i]<=96 || l[i]>=123 && l[i]<=127)
{
output<<“This is a Spacial Character & It is Not allowed on this program…. please change your input\t”<<endl;
}

}

input.close();
output.close();
// readText(inp);
// readText(out);

}

void Caesar::encrypt(char *inp,char *out,int k)
{
ifstream input;
ofstream output;
char l[10000],s[10000];
string line;
input.open(inp);
output.open(out);
getline(input,line);
int n=line.length();
int c;
for(int i=0; i<n; i++)
{
l[i]=line[i];
}
for(int i=0;i<n;i++)
{
if(l[i]<=90 && l[i]>=65)
{
c=l[i]+k;
while(c>90)
{
c=c-90;
c=c+64;
}
s[i]=c;
output<<s[i]; } if(l[i]>=97 && l[i]<=122) { c=l[i]+k; while(c>122)
{
c=c-122;
c=c+96;
}
s[i]=c;
output <<s[i]; } if(l[i]>=48 && l[i]<=57) { c=l[i]+k; while(c>57)
{
c=c-57;
c=c+47;
}
s[i]=c;
output<<s[i]; } if(l[i]>=0 && l[i]<=47 || l[i]>=58 && l[i]<=64 || l[i]>=91 && l[i]<=96 || l[i]>=123 && l[i]<=127)
{
output<<“This is a Spacial Character & It is Not allowed on This Program…. please change your input\t”<<endl;
}
}
input.close();
output.close();
// readText(inp);
// readText(out);
}
/*void Caesar::readText(char *inp)
{
ifstream input;
char buf;
input.open(inp);
cout<<“\n\n\t—–>”<<inp<<“<—–\t\n”;
buf=input.get();
while(!input.eof())
{
cout<<buf;
buf=input.get();
}
input.close();
}*/
main(void)
{
Caesar a;
int choice,key,flag;
char inp[10000],out[10000],text;
cout<<“\t+———————————————–+\t”<<endl;
cout<<“\t|\tComputer Science and Engineering\t|\t”<<endl;
cout<<“\t|\tCSE – 121 \tlanguage C++ \t\t|\t”<<endl;
cout<<“\t|\tAbu Rayhan Ahmad\tID-14152103194\t|\t”<<endl;
cout<<“\t|\tEmail-rayhan.ahmed5000@outlook.com\t|\t”<<endl;
cout<<“\t+———————————————–+\t”<<endl<<endl;
while(1)
{
cout<<endl<<“\tWould you like to ENCRYPT or DECRYPT a file (E or D)?\t”<<endl; cin>>text;
if(text==’e’ || text==’E’)
{
flag=1;
break;
}
else if(text==’d’ || text==’D’)
{
flag=0;
break;
}
}
if(flag==1)
{ cout<<“\t\tEnter File Name with ‘.txt\t\t”<<endl;
cout<<“\tEnter the name of your input file you want to encrypt:\t\t”<<endl; cin>>inp;
cout<<endl<<“\tEnter the name of the output file to write the plaintext:\t\t”<<endl; cin>>out;
cout<<endl<<“\tEnter the numerical key (i.e., an integer) used to encrypt: \t\t”<<endl; cin>>key;
a.encrypt(inp,out,key);
cout<<“File Encrypted,Check output!!”<<endl;
}
else if (flag==0)
{
cout<<“\tEnter the name of your input file you want to decrypt:\t\t”<<endl; cin>>inp;
cout<<endl<<“\tEnter the name of the output file to write the plaintext:\t\t”<<endl; cin>>out;
cout<<endl<<“\tEnter the numerical key (i.e., an integer) used to decrypt: \t\t”<<endl; cin>>key;
a.decrypt(inp,out,key);
cout<<“\t\tFile Decrypted,Check output!!\t\t”<<endl;
}
}

UVA—> 11479 solution


#include<stdio.h>
int main()
{
long int t,a,b,c,i;
while(scanf("%ld",&t)==1)
{
i=1;
while(i<=t)
{
scanf("%ld%ld%ld",&a,&b,&c);
if((a+b)<=c || (b+c)<=a || (c+a)<=b)
printf("Case %ld: Invalid\n",i);
else if(a<=0 || b<=0 || c<=0)
printf("Case %ld: Invalid\n",i);
else if(a==b && b==c)
printf("Case %ld: Equilateral\n",i);
else if(a==b || b==c || c==a)
printf("Case %ld: Isosceles\n",i);
else
printf("Case %ld: Scalene\n",i);
i++;
}
}
return 0;
}