Smart Car Parking System (SCPS) Project in C Free Code Download
The Smart Car Parking System (SCPS) with Source Code is a project that can manage parking of vehicle(Cars, Scooters etc) car or scooter. The system can help you manage and organize the vehicle(Cars, Scooters etc) details within the parking site by entering information such as Plate Number, etc. The purpose of the system is computerize the parking of vehicle(Cars, Scooters etc) in the site area.
About the System
The Smart Car Parking System (SCPS) was created in a simple console application, the system is protected by a login information you need to enter a correct one to access the system. The user can do many task in the system in the system, he/she can add new Vehicle(Cars, Scooters etc) Detail, View Total Park Vehicle(Cars, Scooters etc), Depart Vehicle(Cars, Scooters etc), Arrival Vehicle(Cars, Scooters etc). The system has all the function to park the vehicle(Cars, Scooters etc) in the parking lot. This system can help you park the vehicle(Cars, Scooters etc) efficiently by only entering the vehicle(Cars, Scooters etc) plate number All the inputted data are stored as computer string, if you want to save the data in a database just add a code in the saving script. The
Smart Car Parking System (SCPS) was created in C programming language that has a simple coding structure to be easily understand by new beginners.
Functional requirements of Smart Car Parking System (SCPS)
- Add Vehicle(Cars, Scooters etc)
- Add Vehicle(Cars, Scooters etc) Park
- Add Cars Park
- Add Scooter Park
- Delete Vehicle(Cars, Scooters etc)
- Delete Vehicle(Cars, Scooters etc) Park
- Delete Cars Park
- Delete Scooter Park
- Update Vehicle(Cars, Scooters etc)
- Update Vehicle(Cars, Scooters etc) Park
- Update Cars Park
- Update Scooter Park
- To check the Arrival of Vehicle(Cars, Scooters etc)
- To check the Total Number of Vehicle(Cars, Scooters etc) Park
- To check the Total Number of Cars Park
- To check the Total Number of Scooter Park
- To check the Display Vehicle(Cars, Scooters etc) Park
- To check the Departure of Vehicle(Cars, Scooters etc)
User Login Information
Username: admin
Password: admin
C language for Smart Car Parking System Project
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
#include <stdio.h> #include <conio.h> #include <windows.h> #define CAR 1 #define SCOOTER 2 struct vehicle { int num ; int row ; int col ; int type ; } ; int parkinfo[4][10] ; int vehcount ; int carcount ; int scootercount ; void display( ) ; void changecol ( struct vehicle * ) ; struct vehicle * add ( int, int, int, int ) ; void del ( struct vehicle * ) ; void getfreerowcol ( int, int * ) ; void getrcbyinfo ( int, int, int * ) ; void show( ) ; void changecol ( struct vehicle *v ) { v -> col = v -> col - 1 ; } struct vehicle * add ( int t, int num, int row, int col ) { struct vehicle *v ; v = ( struct vehicle * ) malloc ( sizeof ( struct vehicle ) ) ; v -> type = t ; v -> row = row ; v -> col = col ; if ( t == CAR ) carcount++ ; else scootercount++ ; vehcount++ ; parkinfo[row][col] = num ; return v ; } void login() { int a=0,i=0; char uname[10],c=' '; char pword[10],code[10]; char user[10]="user"; char pass[10]="pass"; do { printf("\n \xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb LOGIN FIRST \xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb "); printf(" \n\n ENTER USERNAME:-"); scanf("%s", &uname); printf(" \n\n ENTER PASSWORD:-"); while(i<10) { pword[i]=getch(); c=pword[i]; if(c==13) break; else printf("*"); i++; } pword[i]='\0'; i=0; if(strcmp(uname,"admin")==0 && strcmp(pword,"admin")==0) { printf(" \n\n\n WELCOME !! YOUR LOGIN IS SUCCESSFUL"); printf("\n\n\n\t\t\t\tPress any key to continue..."); getch();//holds the screen break; } else { printf("\n SORRY !!!! LOGIN IS UNSUCESSFUL"); a++; getch();//holds the screen } } while(a<=2); if (a>2) { printf("\nSorry you have entered the wrong username and password for four times!!!"); getch(); } system("cls"); } void del ( struct vehicle *v ) { int c ; for ( c = v -> col ; c < 9 ; c++ ) parkinfo[v -> row][c] = parkinfo[v -> row][c+1] ; parkinfo[v -> row][c] = 0 ; if ( v -> type == CAR ) carcount-- ; else scootercount-- ; vehcount-- ; } void getfreerowcol ( int type, int *arr ) { int r, c, fromrow = 0, torow = 2 ; if ( type == SCOOTER ) { fromrow += 2 ; torow += 2 ; } for ( r = fromrow ; r < torow ; r++ ) { for ( c = 0 ; c < 10 ; c++ ) { if ( parkinfo[r][c] == 0 ) { arr[0] = r ; arr[1] = c ; return ; } } } if ( r == 2 || r == 4 ) { arr[0] = -1 ; arr[1] = -1 ; } } /* get the row-col position for the vehicle with specified number */ void getrcbyinfo ( int type, int num, int *arr ) { int r, c, fromrow = 0, torow = 2 ; if ( type == SCOOTER ) { fromrow += 2 ; torow += 2 ; } for ( r = fromrow ; r < torow ; r++ ) { for ( c = 0 ; c < 10 ; c++ ) { if ( parkinfo[r][c] == num ) { arr[0] = r ; arr[1] = c ; return ; } } } if ( r == 2 || r == 4 ) { arr[0] = -1 ; arr[1] = -1 ; } } /* displays list of vehicles parked */ void display( ) { int r, c ; printf ( "\xdb\xdb Cars =>\n" ) ; for ( r = 0 ; r < 4 ; r++ ) { if ( r == 2 ) printf ( "\xdb\xdbScooters =>\n" ) ; for ( c = 0 ; c < 10 ; c++ ) printf ( "%d\t", parkinfo[r][c] ) ; printf ( "\n" ) ; } } int first( ) { printf("\n\t\t\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\n"); printf("\t\t\xdb \xdb\n"); printf("\t\t\xdb ============================= \xdb\n"); printf("\t\t\xdb Car PARKING MANAGEMENT \xdb\n"); printf("\t\t\xdb ============================= \xdb\n"); printf("\t\t\xdb \xdb\n"); printf("\t\t\xdb \xdb\n"); printf("\t\t\xdb \xdb\n"); printf("\t\t\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\n\n\n"); printf(" \n\t Press Any Key To Continue:"); getch(); system("cls"); login(); } int main( ) { int choice, type, number, row = 0, col = 0 ; int i, tarr[2] ; int finish = 1 ; struct vehicle *car[2][10] ; struct vehicle *scooter[2][10] ; system ( "cls" ) ; first(); while ( finish ) { system ( "cls" ) ; printf ( "\n\t\xdb\xdb\xdb\xdb\xdb\xdb\xdb VEHICLE PARKING \xdb\xdb\xdb\xdb\xdb\xdb\xdb\n" ) ; printf ( "\n\t1>> Arrival Of Vehicle\n" ) ; printf ( "\n\t2>> Total No. Of Vehicles Parked\n" ) ; printf ( "\n\t3>> Total No. Of Cars Parked\n" ) ; printf ( "\n\t4>> Total No. Of Scooters Parked\n" ) ; printf ( "\n\t5>> Display Vehicles Parked (Order)\n" ) ; printf ( "\n\t6>> Departure Of Vehicle\n" ) ; printf ( "\n\t7>> Exit\n" ) ; printf ("\n\t\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb\xdb"); printf(" \n\n Enter Your Choice Here:"); scanf ( "%d", &choice ) ; switch ( choice ) { case 1 : system ( "cls" ) ; printf ( "\n\t\xdb\xdb Add: \xdb\xdb \n" ) ; type = 0 ; /* check for vehicle type */ while ( type != CAR && type != SCOOTER ) { printf ( "\tEnter vehicle type (1 for Car / 2 for Scooter ): \n" ) ; scanf ( "%d", &type ) ; if ( type != CAR && type != SCOOTER ) printf ( "\nInvalid vehicle type.\n" ) ; } printf ( "Enter vehicle number: " ) ; scanf ( "%d", &number ) ; /* add cars' data */ if ( type == CAR || type == SCOOTER ) { getfreerowcol ( type, tarr ) ; if ( tarr[0] != -1 && tarr[1] != -1 ) { row = tarr[0] ; col = tarr[1] ; if ( type == CAR ) car[row][col] = add ( type, number, row, col ) ; else scooter[row - 2][col] = add ( type, number, row, col ) ; ; } else { if ( type == CAR ) printf ( "\nNo parking slot free to park a car\n" ) ; else printf ( "\nNo parking slot free to park a scooter\n" ) ; } } else { printf ( "Invalid type\n" ) ; break ; } printf ( "\nPress any key to continue..." ) ; getch( ) ; break ; case 2 : system ( "cls" ) ; printf ( "Total vehicles parked: %d\n", vehcount ) ; printf ( "\nPress any key to continue..." ) ; getch( ) ; break ; case 3 : system ( "cls" ) ; printf ( "Total cars parked: %d\n", carcount ) ; printf ( "\nPress any key to continue..." ) ; getch( ) ; break ; case 4 : system ( "cls" ) ; printf ( "Total scooters parked: %d\n", scootercount ) ; printf ( "\nPress any key to continue..." ) ; getch( ) ; break ; case 5 : system ( "cls" ) ; printf ( "Display\n" ) ; display( ) ; printf ( "\nPress any key to continue..." ) ; getch( ) ; break ; case 6 : system ( "cls" ) ; printf ( "Departure\n" ) ; type = 0 ; /* check for vehicle type */ while ( type != CAR && type != SCOOTER ) { printf ( "Enter vehicle type (1 for Car / 2 for Scooter ): \n" ) ; scanf ( "%d", &type ) ; if ( type != CAR && type != SCOOTER ) printf ( "\nInvalid vehicle type.\n" ) ; } printf ( "Enter number: " ) ; scanf ( "%d", &number ) ; if ( type == CAR || type == SCOOTER ) { getrcbyinfo ( type, number, tarr ) ; if ( tarr[0] != -1 && tarr[1] != -1 ) { col = tarr [1] ; /* if the vehicle is car */ if ( type == CAR ) { row = tarr [0] ; del ( car [row][col] ) ; for ( i = col ; i < 9 ; i++ ) { car[row][i] = car[row][i + 1] ; changecol ( car[row][i] ) ; } free ( car[row][i] ) ; car[row][i] = NULL ; } /* if a vehicle is scooter */ else { row = tarr[0] - 2 ; if ( ! ( row < 0 ) ) { del ( scooter[row][col] ) ; for ( i = col ; i < 9 ; i++ ) { scooter[row][i] = scooter[row][i + 1] ; changecol ( scooter[row][col] ) ; } scooter[row][i] = NULL ; } } } else { if ( type == CAR ) printf ( "\nInvalid car number, or a car with such number has not been parked here.\n" ) ; else printf ( "\nInvalid scooter number, or a scooter with such number has not been parked here.\n" ) ; } } printf ( "\nPress any key to continue..." ) ; getch( ) ; break ; case 7 : system ( "cls" ) ; for ( row = 0 ; row < 2 ; row++ ) { for ( col = 0 ; col < 10 ; col++ ) { if ( car[row][col] -> num != 0 ) free ( car[row][col] ) ; if ( scooter[row][col] -> num != 0 ) free ( scooter[row+2][col] ) ; } } finish = 0 ; break ; } } return 0 ; } |
![Car Parking System Project in C](https://projectsinventory.com/wp-content/uploads/Car-Parking-System-Project-in-C.webp)