├── Bubble-Sort.cpp ├── Lab1Task1.cpp ├── Lab1Task2.cpp ├── README.md ├── Searching-Algos.cpp ├── Simple-CMS.cpp └── Sorting-Algos.cpp /Bubble-Sort.cpp: -------------------------------------------------------------------------------- 1 | //Name : Abdullah Ajmal 2 | 3 | #include 4 | using namespace std; 5 | 6 | //Created a structure called Student 7 | struct Student{ 8 | int stSap; 9 | string stName ; 10 | }; 11 | 12 | //Created a function for Bubble Sort 13 | void bubbleSort(Student students[]){ 14 | int tempSap; 15 | string tempName; 16 | for(int pass = 0;pass<=19;pass+=1){ 17 | 18 | for(int i = 0;i<19;i+=1){ 19 | if(students[i].stSap 7 | using namespace std; 8 | int main(){ 9 | 10 | const int sizeOfArray = 10; 11 | int arr[sizeOfArray] = {1}; 12 | int *ptr = arr; 13 | 14 | 15 | for(int i = 0; i>"; 17 | // Taking input 18 | cin>>*(ptr+(4*i)); 19 | } 20 | 21 | for(int i = 0; i 6 | using namespace std; 7 | int main(){ 8 | 9 | const int rows = 5; 10 | const int columns = 4; 11 | double arr[rows][columns]; 12 | char choice; 13 | 14 | 15 | 16 | while(1){ 17 | 18 | cout<<"Enter A\tto Enter Data"<>";cin>>choice; 25 | 26 | if(choice=='A'){ 27 | cout<<"--- Data Entry ---"<>arr[i][j]; 32 | cout<>checkId; 43 | 44 | cout<<"--- Displaying Marks ---"<>checkId; 57 | for(int i=1;i=90){ 62 | cout<<"Congrats! You recieved A grade."<=85){ 64 | cout<<"Not Bad! You recieved B grade."<70){ 66 | cout<<"Can do better! You recieved C grade."< 6 | using namespace std; 7 | 8 | 9 | int main(){ 10 | 11 | cout<<"--->> MENU <<---"<>";cin>>option; 23 | //OPTION 1 24 | if(option=='1'){ 25 | cout<<"--- Storing Data ---"<>";cin>>array[i]; 28 | } 29 | cout<<"|| Data Stored Successfully ||"<>";cin>>target; 49 | for(int i=0;i<10;i+=1){ 50 | if(array[i] == target){ 51 | found = true; 52 | targetInd = i; 53 | break; 54 | } 55 | } 56 | 57 | if(found==true){ 58 | cout<<"The Element was found at Index "<>";cin>>target; 76 | if(target>=array[mid]){ 77 | for(int i=mid;i<10;i+=1){ 78 | if(array[i]==target){ 79 | found=true; 80 | targetInd = i; 81 | break; 82 | } 83 | } 84 | }else{ 85 | for(int i=mid-1;i>=0;i-=1){ 86 | if(array[i]==target){ 87 | found=true; 88 | targetInd = i; 89 | break; 90 | } 91 | } 92 | } 93 | 94 | if(found==true){ 95 | cout<<"The Element was found at Index "< 5 | #include 6 | #include 7 | using namespace std; 8 | struct student{ 9 | char sname[20]; 10 | string smail; 11 | char faddress[60]; 12 | int sphone; 13 | }; 14 | void addcoursef(); 15 | void renamef(); 16 | void deletef(); 17 | void addstudentf(student stns); 18 | void findstudentf(); 19 | void removestudentf(); 20 | int main(){ 21 | int slxt; 22 | student stns; 23 | while(1){ 24 | cout<<"--------------Menu--------------\n"<< 25 | "1\tCreate a Course\n"<< 26 | "2\tDelete a course\n"<< 27 | "3\tRename a Course\n"<< 28 | "4\tAdd Student to Course\n"<< 29 | "5\tFind Student by name\n"<< 30 | "6\tDelete Student\n"<< 31 | "7\tExit\n"<< 32 | "--------------------------------"; 33 | 34 | cout<>"; 35 | cin>>slxt; 36 | switch (slxt){ 37 | case 1:{ 38 | addcoursef(); 39 | break; 40 | } 41 | 42 | case 2:{ 43 | deletef(); 44 | break; 45 | } 46 | 47 | case 3:{ 48 | renamef(); 49 | break; 50 | } 51 | 52 | case 4:{ 53 | addstudentf(stns); 54 | break; 55 | } 56 | 57 | case 5:{ 58 | findstudentf(); 59 | break; 60 | } 61 | 62 | case 6:{ 63 | removestudentf(); 64 | break; 65 | } 66 | 67 | case 7:{ 68 | return 0; 69 | break; 70 | } 71 | default:{ 72 | cout<<"\nInvalid Option"; 73 | break; 74 | } 75 | 76 | } 77 | system("cls"); 78 | } 79 | 80 | } 81 | void addcoursef(){ 82 | char crs[15]; 83 | cin.clear();cin.sync(); 84 | cout<>"; 85 | cin.getline(crs,15); 86 | ofstream ncourse(crs); 87 | cout<>";cin.getline(crs,15); 95 | cin.clear();cin.sync(); 96 | cout<<"\nWhat should be the NEW name of the course :\n>>"; 97 | cin.getline(ncrs,15); 98 | rename(crs,ncrs); 99 | cout<>"; 106 | cin.getline(crs,15); 107 | remove(crs); 108 | cout<>"; 113 | cin.clear();cin.sync(); 114 | cin.getline(crs,15); 115 | ofstream opennadd; 116 | opennadd.open(crs,ios :: app); 117 | cout<<"\n:: User Data ::"; 118 | cin.clear();cin.sync(); 119 | cout<<"\n>Enter Students Name>"; 120 | cin.getline(stns.sname,20); 121 | opennadd<Enter Address>"; 124 | cin.getline(stns.faddress,60); 125 | opennadd<Enter Phone>"; 127 | cin>>stns.sphone; 128 | opennadd<Enter Students Gmail>"; 130 | cin>>stns.smail; 131 | opennadd<>"; 140 | cin.clear(); 141 | cin.sync(); 142 | cin.getline(fname,15); 143 | read.open(fname); 144 | if(read.is_open()){ 145 | cout<<"\nFound Course"; 146 | char linez[1000]; 147 | string x; 148 | string find; 149 | cout<<"\nEnter name of student you want to find:\n>>"; 150 | cin>>find; 151 | int i=0; 152 | bool found=false; 153 | while(!read.eof()){ 154 | read.getline(linez,1000); 155 | x=linez; 156 | if(x==find){ 157 | found=true; 158 | cout<<"\nName:"<>";cin>>del; 201 | ofstream rf("temperXtt.txt"); 202 | bool startdel=false; 203 | int delcounter=6; 204 | while(!reader.eof()){ 205 | reader.getline(stringer,1000); 206 | if(stringer==del){ 207 | startdel=true; 208 | } 209 | if(startdel==true && delcounter>=1){ 210 | delcounter--; 211 | continue; 212 | } 213 | hml=stringer; 214 | rf< 5 | using namespace std; 6 | 7 | 8 | int main(){ 9 | int array[10]; 10 | int *ptr = array; 11 | 12 | 13 | 14 | 15 | 16 | //*(ptr + (i*4)) 17 | char option; 18 | 19 | while(1){ 20 | 21 | cout<<"--->> MENU <<---"<>";cin>>option; 29 | 30 | //OPTION 1 31 | if(option == '1'){ 32 | cout<<"--- Enter Values for the Array ---"<>";cin>>array[i]; 35 | 36 | } 37 | } 38 | 39 | 40 | //OPTION 2 41 | else if(option =='2'){ 42 | cout<<"--- Displaying Array Data ---"<array[j+1]){ 55 | 56 | int temp = array[j]; 57 | array[j] = array[j+1]; 58 | array[j+1] = temp; 59 | 60 | } 61 | } 62 | 63 | } 64 | cout<