Pages

💡 Now You Can Get your Assignments Sollution here... .💡 100% plagiarism Free Service...💡 Responsibility, punctuality and on-time delivery... 💡 Furnishing you with experts... 💡 experienced in your subject 100% privacy... 💡 helping you with the highest efficiency , professionalism Affordable and budget-friendly costs that do not make a hole in your wallet

Showing posts with label Assignments. Show all posts
Showing posts with label Assignments. Show all posts

Kids IQ level test Creater program

Kids IQ level test Creater program




#include<iostream>

#include<windows.h>

#include<fstream>

#include<conio.h>

#include<string>

using namespace std;

int intro(void);

void setcolor(unsigned short color);


int main()

{


int log = 24, no_students = 0, no_tests = 0, no_question = 0, roll_no, *counter = new int[no_students], *position = new int[no_students];

int **marks = new int *[no_students], *level = new int[no_question];

int appericiate, value1 = 0, value = 0, val = 0, answer, orignal_answer, ans_wrong = 3;

char type;

string as = "Bravo!";

string asd = "Terrific!";

string asf = "Fabulous!";

string asg = "Awesome!";

string ash = "Does not matter, keep it up";

string asj = "I like your enthusiasm.";

string ask = "Once you learn to quit, it becomes a habit…. KEEP GOING!";

intro();

system("COLOR 0C");

setcolor(14);

username:

cout << "<><><><><><><><><><><><><><><><><><><><><><><><<><><><><><><><><<><><><><><><><>" << endl;

cout << "<> WELCOME TO UCp KIDS CORNER <>" << endl;

cout << "<><><><><><><><><><><><><><><><><><><><><><><><<><><><><><><><><<><><><><><><><>\n\n\n\n\n";

string user, use = "user";

string password = "qwerty";

string pass;

cout << endl << endl << "\n\n Enter username: ";

cin >> user;

cout << "\n Password: ";

cin >> pass;

if (user == use)

{

if (pass != password)

{

cout << "wrong password wait..." << endl;

Sleep(3000);

system("cls");

goto username;

}

else

{

system("cls");

cout << "Welcome to teacher account" << endl << endl;

menu:

Sleep(2000);

system("cls");

cout << "\n\n\n\n\n\n\n\n\t\t\tplease press '0 for Logout" << endl;

cout << "\t\t\tplease press '1' to check results" << endl;

cout << "\t\t\tplease press '2' to create test " << endl;

cout << "\t\t\tplease press '3' for Student Login" << endl;

cin >> log;

switch (log)

{

case 0:

{

system("cls");

cout << "\n\n\n\n\n\n\t\t\t\t\tyou have loged out" << endl;

break;

}

case 1:

{

system("cls");

////////////////////////////////////////

int rooll, tes;

cout << "enter the student roll no (1-" << no_students + 1 << ") :";

cin >> rooll;

cout << "enter the test no (1-" << no_tests + 1 << ") : ";

cin >> tes;

cout << endl << marks[rooll - 1][tes - 1];

//results add karo////////////////////////////////////////

system("pause");

goto menu;

}

case 2:

{

system("cls");

cout << "\n\n\n\n\t\tNumber of students in class :";

cin >> no_students;

cout << "\n\t\tNumber of tests :";

cin >> no_tests;

cout << "\n\t\tNumber of Questions in test :";

cin >> no_question;

system("pause");


for (int k = 0; k<no_students; k++)

{

position[k] = 0;

level[k] = 0;

marks[k] = 0;

}

goto menu;

}

case 3:

{

system("cls");

for (int i = 0; i<no_students; i++)

{

marks[i] = new int[no_tests];

}

//////////////////////student////////////////////////////////////

login:

//cout<<"press '0' if you want to LOGOUT"<<endl;

cout << "\n\n\n\t\tplease enter your roll number(1-" << no_students << ") :";

cin >> roll_no;

if (no_students>0)

{

if (counter[roll_no - 1] != 1)

{

level[roll_no - 1]++;

if (level[roll_no - 1] == no_question)

{

counter[roll_no - 1] = 1;

}

if (roll_no - 1 <= no_students)

{

{

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////test


/////////////////////////

for (int i = 0; i<no_question; i++)

level[i] = 0;

///////////////////// /

int count = 0;

choice:

system("cls");

cout << "\n\n\n\t\tplease choose the type or operation :";

cin >> type;


while (position[roll_no - 1]<no_question)

{

char p;

cout << "\n\n\n\t\tpress 'E' to qiut test & any other key to continue" << endl;

cin >> p;

if (p == 'E')

{

cout << "\n\n\n\n\n\n\nRoll#" << roll_no << " at question# " << position[roll_no - 1] << " loged out :]"<<endl;

goto menu;

}

count++;

position[roll_no - 1] += 1;

switch (type)

{

case'+':

{

if (level[roll_no - 1] <= (no_question / 2))

{

level[roll_no - 1] += 1;

value = rand() % 10;

value1 = rand() % 10;

orignal_answer = value + value1;

re_answerepls:



cout << "\n\n\n\n\n\t\t ******************************************" << endl;

cout << "\t\t * \t" << "Q#" << position[roll_no - 1] << "\t" << value << " + " << value1 << " = ?\t *" << endl;

cout << "\t\t ******************************************" << endl;

cout << "\n\n\n\t\t\t\t ANS: ";

cin >> answer;


if (answer == orignal_answer)

{

randum:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t\t " << as << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t\t\t\t " << asd << endl;

}

else if (appericiate == 3)

{

cout << "\n\n\t\t\t\t " << asf << endl;

}

else if (appericiate == 4)

{

cout << "\n\n\t\t\t\t " << asg << endl;

}

else if (appericiate == 5)

{

cout << "\n\n\t\t\t " << asj << endl;

}

else

goto randum;

//Sleep(5000);

marks[roll_no - 1]++;

}

else

{

if (ans_wrong>0)

{

ans_wrong--;

randum1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t" << ash << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t" << ask << endl;

}

else

goto randum1;

//Sleep(7000);

goto re_answerepls;

}

}

// goto usename;

}

else///

{

val = rand() % 100;

value = rand() % 100;

value1 = rand() % 100;

orignal_answer = value + value1 + val;

re_answerepls1:

cout << "\n\n\n\n\n\t\t ************************************************" << endl;

cout << "\t\t *\t\t" << "Q#" << position[roll_no - 1] << "\t" << value << " + " << value1 << " + " << val << " = ? *\n";

cout << "\t\t ************************************************" << endl;

cout << "\n\n\n\t\t\t\t ANS: ";

cin >> answer;

if (answer == orignal_answer)

{

randumpls1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t\t " << as << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t\t\t\t " << asd << endl;

}

else if (appericiate == 3)

{

cout << "\n\n\t\t\t\t " << asf << endl;

}

else if (appericiate == 4)

{

cout << "\n\n\t\t\t\t " << asg << endl;

}

else if (appericiate == 5)

{

cout << "\n\n\t\t\t " << asj << endl;

}

else

goto randumpls1;

//Sleep(7000);

marks[roll_no - 1]++;

}

else

{

if (ans_wrong>0)

{

ans_wrong--;

randumplx1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t" << ash << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t" << ask << endl;

}

else

goto randumplx1;

// Sleep(7000);

// system("cls");

goto re_answerepls1;

}

}

}

//system("cls");

break;

}

case'-':

{

if (level[roll_no - 1] <= (no_question / 2))

{

level[roll_no - 1] += 1;

value = rand() % 10;

value1 = rand() % 10;

orignal_answer = value - value1;

re_answeremin:

cout << "\n\n\n\n\n\t\t ******************************************" << endl;

cout << "\t\t * \t" << "Q#" << position[roll_no - 1] << "\t" << value << " - " << value1 << " = ?\t *" << endl;

cout << "\t\t ******************************************" << endl;

cout << "\n\n\n\t\t\t\t ANS: ";

cin >> answer;

if (answer == orignal_answer)

{

randummin:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t\t " << as << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t\t\t\t " << asd << endl;

}

else if (appericiate == 3)

{

cout << "\n\n\t\t\t\t " << asf << endl;

}

else if (appericiate == 4)

{

cout << "\n\n\t\t\t\t " << asg << endl;

}

else if (appericiate == 5)

{

cout << "\n\n\t\t\t " << asj << endl;

}

else

goto randummin;

marks[roll_no - 1]++;

Sleep(7000);

}

else

{

if (ans_wrong>0)

{

ans_wrong--;

randummin1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t" << ash << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t" << ask << endl;

}

else

goto randummin1;

Sleep(7000);

goto re_answeremin;

}

}

//goto username;

}

else

{

val = rand() % 100;

value = rand() % 100;

value1 = rand() % 100;

orignal_answer = value - value1 - val;

re_answeremin1:

cout << "\n\n\n\n\n\t\t ************************************************" << endl;

cout << "\t\t *\t\t" << "Q#" << position[roll_no - 1] << "\t" << value << " - " << value1 << " - " << val << " = ? *\n";

cout << "\t\t ************************************************" << endl;

cout << "\n\n\n\t\t\t\t ANS: ";

cin >> answer;

if (answer == orignal_answer)

{

randummin2:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t\t " << as << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t\t\t\t " << asd << endl;

}

else if (appericiate == 3)

{

cout << "\n\n\t\t\t\t " << asf << endl;

}

else if (appericiate == 4)

{

cout << "\n\n\t\t\t\t " << asg << endl;

}

else if (appericiate == 5)

{

cout << "\n\n\t\t\t " << asj << endl;

}

else

goto randummin2;

marks[roll_no - 1]++;

Sleep(7000);

}

else

{

if (ans_wrong>0)

{

ans_wrong--;

randumminx1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t" << ash << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t" << ask << endl;

}

else

goto randumminx1;

Sleep(7000);

goto re_answeremin1;


}

}


}

break;

}

/////////////////////////////end of case min

//start of case divide/////////////////////

case'/':

{if (level[roll_no - 1] <= (no_question / 2))

{

level[roll_no - 1] += 1;

value = rand() % 10;

value1 = rand() % 10;

orignal_answer = value / value1;

re_answerediv:

cout << "\n\n\n\n\n\t\t ******************************************" << endl;

cout << "\t\t * \t" << "Q#" << position[roll_no - 1] << "\t" << value << " / " << value1 << " = ?\t *" << endl;

cout << "\t\t ******************************************" << endl;

cout << "\n\n\n\t\t\t\t ANS: ";

cin >> answer;

if (answer == orignal_answer)

{

randumdi:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t\t " << as << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t\t\t\t " << asd << endl;

}

else if (appericiate == 3)

{

cout << "\n\n\t\t\t\t " << asf << endl;

}

else if (appericiate == 4)

{

cout << "\n\n\t\t\t\t " << asg << endl;

}

else if (appericiate == 5)

{

cout << "\n\n\t\t\t " << asj << endl;

}

else

goto randumdi;

marks[roll_no - 1]++;

Sleep(7000);

}

else

{

if (ans_wrong>0)

{

ans_wrong--;

randumd1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t" << ash << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t" << ask << endl;

}

else

goto randumd1;

Sleep(7000);

goto re_answerediv;

}

}

break;

}

else///

{

val = rand() % 100;

value = rand() % 100;

value1 = rand() % 100;

orignal_answer = value / value1 / val;

re_answerediv1:

cout << "\n\n\n\n\n\t\t ************************************************" << endl;

cout << "\t\t *\t\t" << "Q#" << position[roll_no - 1] << "\t" << value << " / " << value1 << " / " << val << " = ? *\n";

cout << "\t\t ************************************************" << endl;

cout << "\n\n\n\t\t\t\t ANS: ";

cin >> answer;

if (answer == orignal_answer)

{

randumdivv1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t\t " << as << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t\t\t\t " << asd << endl;

}

else if (appericiate == 3)

{

cout << "\n\n\t\t\t\t " << asf << endl;

}

else if (appericiate == 4)

{

cout << "\n\n\t\t\t\t " << asg << endl;

}

else if (appericiate == 5)

{

cout << "\n\n\t\t\t " << asj << endl;

}

else

goto randumdivv1;

Sleep(7000);

marks[roll_no - 1]++;

}

else

{

if (ans_wrong>0)

{

ans_wrong--;

randumdivx1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t" << ash << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t" << ask << endl;

}

else

goto randumdivx1;

Sleep(7000);

goto re_answerediv1;

}

}

break;

}

}

////////////////////////////////////end of case divide///

//start of case multiplication///////////////////////////

case'*':

{

if (level[roll_no - 1] <= (no_question / 2))

{

level[roll_no - 1] += 1;

value = rand() % 10;

value1 = rand() % 10;

orignal_answer = value*value1;

re_answeremul:

cout << "\n\n\n\n\n\t\t ******************************************" << endl;

cout << "\t\t * \t" << "Q#" << position[roll_no - 1] << "\t" << value << " * " << value1 << " = ?\t *" << endl;

cout << "\t\t ******************************************" << endl;

cout << "\n\n\n\t\t\t\t ANS: ";

cin >> answer;

if (answer == orignal_answer)

{

randummul:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t\t " << as << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t\t\t\t " << asd << endl;

}

else if (appericiate == 3)

{

cout << "\n\n\t\t\t\t " << asf << endl;

}

else if (appericiate == 4)

{

cout << "\n\n\t\t\t\t " << asg << endl;

}

else if (appericiate == 5)

{

cout << "\n\n\t\t\t " << asj << endl;

}

else

goto randummul;

Sleep(7000);

marks[roll_no - 1]++;

}

else

{

if (ans_wrong>0)

{

ans_wrong--;

randummul1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t" << ash << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t" << ask << endl;

}

else

goto randummul1;

Sleep(7000);

goto re_answeremul;

}

}

break;

}

else///

{

val = rand() % 100;

value = rand() % 100;

value1 = rand() % 100;

orignal_answer = value*value1*val;

re_answeremul1:

cout << "\n\n\n\n\n\t\t ************************************************" << endl;

cout << "\t\t *\t\t" << "Q#" << position[roll_no - 1] << "\t" << value << " * " << value1 << " * " << val << " = ? *\n";

cout << "\t\t ************************************************" << endl;

cout << "\n\n\n\t\t\t\t ANS: ";

cin >> answer;

if (answer == orignal_answer)

{

randummul2:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t\t " << as << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t\t\t\t " << asd << endl;

}

else if (appericiate == 3)

{

cout << "\n\n\t\t\t\t " << asf << endl;

}

else if (appericiate == 4)

{

cout << "\n\n\t\t\t\t " << asg << endl;

}

else if (appericiate == 5)

{

cout << "\n\n\t\t\t " << asj << endl;

}

else

goto randummul2;

Sleep(7000);

marks[roll_no - 1]++;

}

else

{

if (ans_wrong>0)

{

ans_wrong--;

randummulx1:

appericiate = rand() % 10;

if (appericiate == 1)

{

cout << "\n\n\t\t\t" << ash << endl;

}

else if (appericiate == 2)

{

cout << "\n\n\t" << ask << endl;

}

else

goto randummulx1;

Sleep(7000);

goto re_answeremul1;

}

}

break;

}

}

default:

{

cout << "wrong choice :(\n";

goto choice;

}


}

if (no_question == count)

{

system("cls");

cout << "\n\n\n\t\t\tCongrates you complete your test " << no_tests + 1 << endl;

cout << "\n\n\n\n\t\t\t\tRoll# " << roll_no << " signed out\n\n\n" << endl;

goto menu;

}

}//end of while<no_questions/end of while

//////////////////////////////////////////////////////////////////////////////////////////////////////////////end test

}

}


else

{

system("cls");

cout << "Roll number you have enter is not present in this class :]" << endl;

goto login;

}

}

else

{

system("cls");

cout << "you have already done this test" << endl;

goto menu;

}

}

else

{

system("cls");

cout << "Roll number you have enter is not present in this class :]\n or may be test not be genrated" << endl;

goto menu;

}


}//end of student loop


default:

{

cout << "wrong choice" << endl;

}

}/////////end of switch(log)

}

}

else

{

cout << "Wrong Username wait..." << endl;

Sleep(3000);

system("cls");

goto username;

}

system("pause");

return 0;

}

int intro()

{

cout << " __" << endl;

cout << " ,-~¨^ ^¨-, _," << endl;

cout << " / / ;^-._...,¨/" << endl;

cout << " / / / / Regards:" << endl;

cout << " / / / / ucpjunior.blogspot.com" << endl;

cout << " / / / / A helping blog for ucpians" << endl;

cout << " /,.-:''-,_ / / / Tell your friends about ucpjunior" << endl;

cout << " _,.-:--._ ^ ^:-._ __../ because sharing is caring " << endl;

cout << " /^ / /¨:.._¨__.;" << endl;

cout << " / / / ^ /" << endl;

cout << " / / / /" << endl;

system("COLOR 1F");

cout << " / / / /" << endl;

cout << " /_,.--:^-._/ / /" << endl;

cout << " ^ ^¨¨-.___.:^ " << endl;

cout << " microHARD :)" << endl;

cout << " LOADING..." << endl;

cout << " =";

Sleep(500); cout << "="; Sleep(500); cout << "="; Sleep(500); cout << "="; Sleep(500); cout << "=";

Sleep(500); cout << "="; Sleep(500); cout << "="; Sleep(500);

cout << "="; Sleep(500); cout << "=" << endl; Sleep(1000);

system("cls");

return 0;

}

void setcolor(unsigned short color) //The function that you'll use to

{ //set the colour

HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);

SetConsoleTextAttribute(hcon, color);

}

Swapping,Searching, Replacing in array

#include<iostream>
using namespace std;
void swap(int&,int&);
void swap(int [],int[],int);
void swap(char&,char&);
void swap(char[],char[]);
void printarr(const int[],int);
void printarr(const char[]);
int stringlength(char []);
bool searchsubstring(char[],char[]);
bool replacesubstring(char[],char[],char[]);                             //All green lines arfe function prototypes.
void main()                                                                        //main starts here 
{
char array1[100]={'\0'};                       //here both arrayrs array1 & array2 are of size 100 & 10 ,respectively  
char array2[10]={'\0'};                       //and having value NULL on all of its locations
int a=4,b=32;
int a1[5],b1[5];
for(int i=0;i<5;i++)
{
a1[i]=i;
b1[i]=i+5;
}
char ch1,ch2;
ch1='A';
ch2='z';
char arr1[5]={'A','Z','r','Y'};
char arr2[5]={'b','E','i','s'};
cout<<"Without Swap int\n";
cout<<"a:"<<a<<" b:"<<b<<"\n";
swap(a,b);
cout<<"After Swap\n";
cout<<"a:"<<a<<" b:"<<b<<"\n";
cout<<"________________________________________________________\n";
cout<<"Without swap int[]\narr1:";
for(int i=0;i<5;i++)
cout<<a1[i]<<" ";
cout<<"\narr2:";
for(int i=0;i<5;i++)
cout<<b1[i]<<" ";
swap(a1,b1,5);
cout<<"\nAfter swap int[]\narr1:";
for(int i=0;i<5;i++)
cout<<a1[i]<<" ";
cout<<"\narr2:";
for(int i=0;i<5;i++)
cout<<b1[i]<<" ";
cout<<"\n________________________________________________________\n";
cout<<"Without swap char\nch1:";
cout<<ch1;
cout<<"\nch2:";
cout<<ch2;
cout<<"\nAfter swap char\nch1:";
swap(ch1,ch2);
cout<<ch1;
cout<<"\nch2:";
cout<<ch2;
cout<<"\n________________________________________________________\n";
cout<<"Without swap char[]\narr1:";
for(int i=0;i<5;i++)
cout<<arr1[i]<<" ";
cout<<"\narr2:";
for(int i=0;i<5;i++)
cout<<arr2[i]<<" ";
cout<<"\nAfter swap char[]\narr1:";
swap(arr1,arr2);
for(int i=0;i<5;i++)
cout<<arr1[i]<<" ";
cout<<"\narr2:";
for(int i=0;i<5;i++)
cout<<arr2[i]<<" ";
cout<<"\n________________________________________________________\n";
cout<<"print array 1 of int\n";
cout<<"arr1:";
printarr(a1,5);
cout<<"\n________________________________________________________\n";
cout<<"print array 1 of char\n";
cout<<"arr1:";
printarr(arr1);
cout<<"\n________________________________________________________\n";
cout<<"Enter String:";
cin.getline(array1,100,'\n');
cout<<"length on array1 is:"<<stringlength(array1);
cout<<"\n________________________________________________________\n";
cout<<"search substring in array 1 of char string\n";
cout<<"Enter Sub string:";
cin>>array2;
cout<<searchsubstring(array1,array2);
cout<<"\n________________________________________________________\n";
char array3[10];
cout<<"Search and Replace substring in array 1 of char string\n";
cout<<"Enter Sub string:";
cin>>array2;
cout<<"Enter String to Replace:";
cin>>array3;
replacesubstring(array1,array2,array3);
cout<<"\nReplaced array:";
cout<<array1;
cout<<"\n________________________________________________________\n";
}
void swap(int &a,int& b)
{
a=a+b;
b=a-b;
a=a-b;
}
void swap(int a[],int b[],int size)
{
int temp;
for(int i=0;i<size;i++)
{
temp=a[i];
a[i]=b[i];
b[i]=temp;
}
}
void swap(char& c1,char& c2)
{
char temp;
temp=c1;
c1=c2;
c2=temp;
}
void swap(char a[],char b[])
{
char temp;
for(int i=0;i<5;i++)
{
temp=a[i];
a[i]=b[i];
b[i]=temp;
}
}
void printarr(const int a[],int size)
{
for(int i=0;i<size;i++)
cout<<a[i]<<" ";
}
void printarr(const char a[])
{
for(int i=0;i<5;i++)
cout<<a[i]<<" ";
}
int stringlength(char a[])
{
for(int i=0;i<100;i++)
{
if(a[i]=='\0')
return i;
}
return 0;
}
bool searchsubstring(char a[],char b[])
{
int y=strlen(b);
y--;
for(int i=0;i<100;i++)
{
if(a[i]==b[0])
{
for(int j=0;j<10;j++)
{
if(a[i]==b[j])
{
if(y==j)
{
return 1;
}
i++;
}
}
}
}
return 0;
}
bool replacesubstring(char a[],char b[],char c[])
{
int y=strlen(b);
y--;
for(int i=0;i<100;i++)
{
if(a[i]==b[0])
{
for(int j=0;j<10;j++)
{
if(a[i]==b[j])
{
a[i]=c[j];
if(y==j)
{
return 1;
}
i++;
}
}
}
}
return 0;
}

Bank System in Cpp

#include<iostream>
#include<fstream>
#include<string>
#include<math.h>
#include<iomanip>
#include<conio.h>
using namespace std;
void loading(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20], int pin[200]);
void menudisplay(int& accounts, int pin[200], int acnum[200], int funds[200], char acname[200][20], char type[200]);    //prototype for menu function
void createaccount(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20], int pin[200]);    //prototype for creat account function
void depositfunds(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20],int pins[200]);                  //prototype for deposit funnds function
void withdrawfunds(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20], int pins[200]);                 //prototype for withdrawing funds function
void checkbalance(int& accounts, int acnum[200], int funds[200]);                                                         //prototype for checking balance of indivisual account function
void allaccountholders(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20]);                  //prototype for to see all account holders list function
void closeaccount(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20],int pins[200]);                      //prototype for closing an account function
void modifyaccount(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20],int pins[200]);                     //prototype for modifying an account function
void useraccount(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20], int pin[200]);         //prototype for user can see his account details function
void modify2(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20], int pin[200]);
//***************************************************************
//   the main function of program
//****************************************************************

int main()
{
int pin[200];
char choice;
int accounts = 0;
int acnum[200], funds[200]; char acname[200][20]; char type[200];
int loopvar = 1;
ifstream indata;
indata.open("accounts.txt");
indata >> accounts;
indata.close();
system("color b1");
char  x;
cout << "Do you want to start from 0 accounts , press y for yes .n for no" << endl;
cin >> x;
if (x == 'n' || x == 'N')
{
loading(accounts, acnum, funds, type, acname, pin);
}
if (x == 'y' || x == 'Y')
{
accounts = 0;
}
for (int p = 1; p;)       //for loop to check admin login ,user login ,exit ,,,other wise continue
{
cout << "     .          .  .....  .         ..         ..      .    .      .....\n      .   .    .   .      .       .    .     .    .    ..  ..      .\n       . .  . .    .....  .       .         .      .   . .. .      .....\n        .    .     .      .       .    .     .    .    .    .      .\n                   .....  .....     ..         ..      .    .      ....." << endl;
cin.get();         //a samll function which gives the next operation after pressing "enter"
cout << "\n\n\n                 Admin Login ...press A\n                 User Login .....press U\n                 For Exit press E" << endl;
cin >> choice;
if (choice == 'a' || choice == 'A')
{
do
{
char ch;
int count = 0;
char password[6] = "A^0g0";
string pass;
cout << "Enter the password" << endl;
ch = _getch();           //      this
for (; count<5; count++)     //        will
{                           //             produce
pass.push_back(ch);       //                  stars
cout << '*';           //                         istead of
ch = _getch();            //                               characters of password
}
if (pass == password)
{
loopvar = 0;
menudisplay(accounts, pin, acnum, funds, acname, type);       // calling menu function for admin only
system("CLS");
}
} while (loopvar);    // do_while loop for admin password check
}
if (choice == 'u' || choice == 'U')
{
useraccount(accounts, acnum, funds, type, acname, pin);    //calling user detail function for user only
system("CLS");
}
if (choice == 'E' || choice == 'e')
{
cout << "Thanks for Using Bank Account System" << endl;
p = 0;
}
}
}
//***************************************************************
//     the menu of program
//****************************************************************

void menudisplay(int& accounts, int pin[200], int acnum[200], int funds[200], char acname[200][20], char type[200])
{

int choice = 0;
cout << "*                *                *\n***              ***              ***\n*****            *****            *****\n*******          *******          *******\n*****            *****            *****\n***              ***              ***\n*                *                *" << endl;
for (choice; choice != 8;) //for loop for choice of functions in main menu
{
cout << "\n                 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
cout << "\n                 Press 1 to create new account" << endl;
cout << "\n                 Press 2 to deposit funds " << endl;
cout << "\n                 Press 3 to withdraw funds" << endl;
cout << "\n                 Press 4 to check balance" << endl;
cout << "\n                 Press 5 to view all account holders" << endl;
cout << "\n                 Press 6 to close an account" << endl;
cout << "\n                 Press 7 to modify an account" << endl;
cout << "\n                 Press 8 to exit program" << endl;
cout << "\n                 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" << endl;
cin >> choice;
switch (choice) // switch to connect with required function
{
case 1:
createaccount(accounts, acnum, funds, type, acname, pin);   //calling create account function
system("CLS");
break;
case 2:
depositfunds(accounts, acnum, funds, type, acname,pin);           //calling deposit funds function
system("CLS");
break;
case 3:
withdrawfunds(accounts, acnum, funds, type, acname,pin);        //calling withdraw funds function
system("CLS");
break;
case 4:
checkbalance(accounts, acnum, funds);                        //calling function to check balance of indivisual accounts
system("CLS");
break;
case 5:
allaccountholders(accounts, acnum, funds, type, acname);    //calling all account holders list function
system("CLS");
break;
case 6:
closeaccount(accounts, acnum, funds, type, acname,pin);           //calling close an account function
system("CLS");
break;
case 7:
modifyaccount(accounts, acnum, funds, type, acname,pin);         //calling function to modify an account
system("CLS");
break;
case 8:                                                        //8 for exit
system("CLS");
break;
default:
break;
}
}
}
//***************************************************************
//              create account
//****************************************************************

void createaccount(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20], int pin[200])
{
ofstream outdata;
if (accounts == 0)
{
for (int i = 0; i < 200; i++)       // for loop filling full 2d array with spaces
{
for (int j = 0; j < 20; j++)
{
acname[i][j] = ' ';
}
}
}
if (accounts >199)
{
cout << " you cant save more accounts " << endl; cin.get(); cin.get();
menudisplay(accounts, pin, acnum, funds, acname, type);       // calling menu function for not because accounts are full
}
for (int k = 1; k;)
{
cout << "Account 'number' for User number " << accounts + 1 << endl;
cin >> acnum[accounts];
if (accounts > 0)                                  // if condition and then for loops and then some if conditions to check if account number alreday present
{
for (int f = 0; f < accounts; f++)
{
if (acnum[accounts] == acnum[f])
{
cout << "\nAccount no. Already Present\n" << endl;
k = 1;
break;
}
else
{
k = 0;
}
}
}
else k = 0;
}

if (accounts == 0)
{
outdata.open("acnum.txt");
}
else
outdata.open("acnum.txt", std::fstream::app);
outdata << acnum[accounts] << endl;
outdata.close();
for (int k = 1; k;)
{
cout << "Account 'Name' for User number " << accounts + 1 << endl;
cin >> acname[accounts];
//cin.ignore();
//cin.getline(acname[accounts], 200);
if (accounts > 0)                           // if condition and then for loops and then some if conditions to check if account name alreday present
{
for (int f = 0; f < accounts; f++)
{
if ((strcmp(acname[accounts], acname[f]) == 0))
{
cout << "\nAccount Name Already Present\n" << endl;
k = 1;

}
else
{
k = 0;
}
}
}
else k = 0;
}
if (accounts == 0)
{
outdata.open("acname.txt");
}
else
{
outdata.open("acname.txt", std::fstream::app);
}
outdata << acname[accounts] << endl;
outdata.close();
cout << "Enter Account type < 's' for Saving and 'c' for Current" << endl;
cin >> type[accounts];
if (accounts == 0)
outdata.open("actype.txt");
else
outdata.open("actype.txt", std::fstream::app);
outdata << type[accounts] << endl;
outdata.close();
int h = 1;            //a simple variable
do
{
cout << "Enter the initial amount <500 or more for saving and 1000 or more for current>" << endl;
cin >> funds[accounts];
if (type[accounts] == 's' || type[accounts] == 'S')           //if statement to check account type and then its funds
{
if (funds[accounts] >= 500 && funds[accounts] < 1000)
{
h = 0;
}
}
if (type[accounts] == 'c' || type[accounts] == 'C')           //if statement to check account type and then its funds
{
if (funds[accounts] >= 1000)
{
h = 0;
}
}
}
while (h);
///////////////////////////////////////////
if (accounts == 0)
{
outdata.open("funds.txt");
}
else
outdata.open("funds.txt", std::fstream::app);
outdata << funds[accounts] << endl;
outdata.close();
//////////////////////////////////////////
cout << "Enter the pin code for current" << endl;
cin >> pin[accounts];
if (accounts == 0)
{
outdata.open("pins.txt");
}
else
{
outdata.open("pins.txt", std::fstream::app);
}
outdata << pin[accounts] << endl;
outdata.close();
cout << "Account succesfully created" << endl;
outdata.open("accounts.txt");
accounts++;
outdata << accounts;
outdata.close();
system("CLS");
}
//***************************************************************
//        deposit amount
//****************************************************************

void depositfunds(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20],int pins[200])
{
int acnumd, fundd = 0, counter = 0;
cout << "Enter the account number" << endl;
cin >> acnumd;
for (int i = 0; i < accounts; i++)
{
if (acnum[i] == acnumd)
{

cout << "Account number :" << acnum[i] << endl;
cout << "Account name :" << acname[i] << endl;
cout << "Account type :" << type[i] << endl;
cout << "To deposit amount" << endl;
cout << "                  Enter the amount deposited " << endl;
cin >> fundd;             //entering the amount to add
funds[i] = funds[i] + fundd;
break;
}counter++;
}
cout << "Record updated" << endl; cin.get(); cin.get();
if (counter == accounts){
cout << "Record not found" << endl;              //if statement to check if account not present
}
modify2(accounts, acnum, funds, type, acname, pins);
cin.get(); cin.get();               //a samll function which gives the next operation after pressing "enter"
}
//***************************************************************
//     withdraw funds
//****************************************************************

void withdrawfunds(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20],int pins[200])
{
int acnumd, fundd = 0, counter = 0;
cout << "Enter the account number" << endl;
cin >> acnumd;
for (int i = 0; i < accounts; i++)            //for loop to check the account number and then if present or not
{
if (acnum[i] == acnumd)
{
cout << "Account number :" << acnum[i] << endl;
cout << "Account name :" << acname[i] << endl;
cout << "To withdraw amount" << endl;
cout << "                  Enter the amount withdrawn " << endl;
cin >> fundd;
funds[i] = funds[i] - fundd;
break;
}counter++;
}
cout << "Record updated\n\n" << endl; cin.get(); cin.get();
if (counter == accounts){
cout << "Recrd not found" << endl; //if statement to check if account not present
cin.get(); cin.get();                 //a samll function which gives the next operation after pressing "enter"
}
modify2(accounts, acnum, funds, type, acname, pins);
}
//***************************************************************
//     check balance
//****************************************************************

void checkbalance(int& accounts, int acnum[200], int funds[200])
{
int acnumc;
cout << "Enter the Account Number" << endl;
cin >> acnumc;
for (int i = 0; i < accounts; i++)      //for loop to check the account number and then if present or not
{
if (acnum[i] == acnumc)
{
cout << "Funds are:  " << funds[i];
}
}
cin.get(); cin.get();                       //a samll function which gives the next operation after pressing "enter"
}

//***************************************************************
//     all acount holders
//****************************************************************

void allaccountholders(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20])
{
cout << "\n\n\t\tACCOUNT HOLDER LIST\n\n";
cout << "====================================================\n";
cout << "A/C no.      Name           Type        Balance\n";
cout << "====================================================\n";
for (int i = 0; i < accounts; i++)
{
cout << acnum[i] << "      ";
for (int j = 0; j < 20; j++)
{
cout << acname[i][j];
}cout << "   " << type[i] << "        " << funds[i] << endl;
}
cin.get(); cin.get();                       //a samll function which gives the next operation after pressing "enter"
}
//***************************************************************
//     closing account
//****************************************************************

void closeaccount(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20],int pins[200])
{
int acnumc;
cout << "Enter the Account Number" << endl;
cin >> acnumc;
accounts--;
for (int i = 0; i < accounts; i++)   //for loop to check the account number and then if present or not
{
if (acnum[i] == acnumc)
{
for (int k = i; k < accounts; k++)
{
acnum[k] = acnum[k+1];    //it will replace the account number with zeros
funds[k] = funds[k+1];     //it will replace the account funds with zeros
type[k] = type[k+1];//it will replace the account type with space
pins[k] = pins[k+1];
for (int j = 0; j < 20; j++)
{
acname[k][j] = acname[k+1][j];      //it will replace the account name with spaces
}
}
}
}
ofstream outdata;
outdata.open("accounts.txt");
outdata << accounts;
outdata.close();
modify2(accounts, acnum, funds, type, acname, pins);
cin.get(); cin.get();                //a samll function which gives the next operation after pressing "enter"
}
//***************************************************************
//     modify account
//****************************************************************

void modifyaccount(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20],int pins[200])
{
int choice, acnumu;
cout << "Enter Your Account Number" << endl;
cin >> acnumu;
for (int k = 0; k < accounts; k++)   //for loop to check the account number and then if present or not
{
if (acnumu == acnum[k])
{
cout << "====================================================\n";
cout << "A/C no.      Name           Type        Balance\n";
cout << "====================================================\n";
cout << acnum[k] << "      ";
for (int j = 0; j < 20; j++)
{
cout << acname[k][j];
}cout << "   " << type[k] << "        " << funds[k] << endl;
cout << "                 what do you want in modification function" << endl;
cout << "                 press 1 to change the name of account" << endl;
cout << "                 press 2 to change the type of account" << endl;
cin >> choice;
switch (choice)           //switch statement to go to required case
{
case 1:
for (int j = 0; j < 20; j++) // for loop filling full 2d array with spaces
{
acname[k][j] = ' ';
}
cout << "enter new name" << endl;
cin >> acname[k];
break;
case 2:
cout << "enter new type" << endl;
cin >> type[k];
break;
default:
break;
}
}
}
modify2(accounts, acnum, funds, type, acname, pins);
cin.get(); cin.get();              //a samll function which gives the next operation after pressing "enter"
}
//***************************************************************
//     user can see his account
//****************************************************************

void useraccount(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20], int pin[200])
{
int acnumu, pinu;
cout << "enter your account number" << endl;
cin >> acnumu;
for (int k = 0; k < accounts; k++)   //for loop to check the account number and then if present or not
{
if (acnumu == acnum[k])
{
cout << "enter the pin code of your account" << endl;
cin >> pinu;
if (pinu == pin[k])    //if statement will match pin of that account which entered pin
{
cout << "====================================================\n";
cout << "a/c no.      name           type        balance\n";
cout << "====================================================\n";
cout << acnum[k] << "      ";
for (int j = 0; j < 20; j++)       // for loop to generate the name
{
cout << acname[k][j];
}cout << "   " << type[k] << "        " << funds[k] << endl;
}
}
}
cin.get(); cin.get();      
//a samll function which gives the next operation after pressing "enter"
}
//***************************************************************
//     loading from files
//****************************************************************

void loading(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20], int pin[200])
{
  string s;
ifstream indata;
indata.open("acnum.txt");
for (int k = 0; k < accounts; k++)
{
indata>>acnum[k];
}
indata.close();
indata.open("acname.txt");
for (int k = 0; k < accounts; k++)
{
  indata >> acname[k];
}
indata.close();
indata.open("pins.txt");
for (int k = 0; k < accounts; k++)
{
indata >> pin[k];

}
indata.close();
indata.open("funds.txt");
for (int k = 0; k < accounts; k++)
{
indata >> funds[k];

}
indata.close();
indata.open("actype.txt");
for (int k = 0; k < accounts; k++)
{
indata >> type[k];

}
indata.close();
}
void modify2(int& accounts, int acnum[200], int funds[200], char type[200], char acname[200][20], int pin[200])
{
ofstream outdata;
outdata.open("acname.txt");
for (int k = 0; k < accounts; k++)
{
outdata << acname[k] << endl;
}
outdata.close();
outdata.open("acnum.txt");
for (int k = 0; k < accounts; k++)
{
outdata << acnum[k] << endl;
}
outdata.close();
outdata.open("actype.txt");
for (int k = 0; k < accounts; k++)
{
outdata << type[k] << endl;
}
outdata.close();
outdata.open("funds.txt");
for (int k = 0; k < accounts; k++)
{
outdata << funds[k] << endl;
}
outdata.close();
outdata.open("pins.txt");
for (int k = 0; k < accounts; k++)
{
outdata << pin[k] << endl;
}
outdata.close();


}