Car Parking System Project in C Language with Source Code

Car Parking System Project in C Language with Source Code

This Car Parking System Project in C Language is developed using C programming language. When it comes to the functionality of this Simple system, the user can use it to conduct CRUD tasks. Here, the user can quickly enter vehicle information (Vehicle Number) into the software.

This system makes it simple to keep track of each individual’s records (Arrival & Departures of vehicles). The consumers would find this little project simple to use and comprehend. This is a small C project that was created as a console application.

The system produces an external file to permanently save the user’s data. This system was created using the C programming language, and several variables and strings were employed in its creation.

Car Rental System in C with Source ...
Car Rental System in C with Source Code | C Projects with Source Code

Anyway if you want level up your knowledge in programming especially C/C++ Programming Language, try this new article I’ve made for you Best C Projects with Source Code for Beginners Free Download 2020. In this project is also includes a downloadable  Car Parking System using c for free, just find the downloadable source code below and click Download Rock Paper Scissors to start downloading.

To run this Car Parking System in C make sure that you have a Code Blocks or any platform of C installed in your computer. Please scroll down and click the download button to obtain a free copy of the Parking System project.

ABOUT PROJECTPROJECT DETAILS
Project Name : Car Parking System
Project Platform :C/C++
Programming Language Used:C Programming Language
Developer Name :itsourcecode.com
IDE Tool (Recommended):Dev-C++/Codeblocks
Project Type :Desktop Application
Database:Stores data in .DAT file
Upload Date and Time:July 27, 2021- 7:08 am
Car Parking System Project in C Language with Source Code Overview

Car Parking System Project in C Language Steps On How To Run The Project

Time needed: 5 minutes.

Here’s the step’s on how to run a Car Parking System Project in C Language with Source Code.

  • Step 1: Extract file.

    Next, after you finished download the source code, extract the zip file.
    Extract for Car Parking System Project in C Language with Source Code

  • Step 2: Open CodeBlocks

    After that, After extracting the zip file, open your “CodeBlocks IDE”.
    Open Code blocks Apps for Extract file for Matchstick game in C with Source Code

  • Step 3: Open Project.

    Then, open file tab and Open File after that open folder CPSP-IN-C then click the “main“.

  • Step 4: Run Project

    Lastly, Open build tab and select build and run or you can use key F9.

  • Step 5: The actual code.

    Finally, You are free to copy the given source code below or download the downloadable source code given.

This Car Parking System Project in C Language was build and run under Code::Blocks IDE.

  • Function to to store vehicle number, and its row-col position in an array.
struct car_management
{
	int car_number ;
	int car_row ;
	int car_column ;
  int car_type ;
  struct tm *at;
} ;
  • Function to decrements the column number by one this fun is called when the data is shifted one place to left.
void column_change ( struct car_management *v )
{
	v -> car_column--;
}
  • The function to scan the year, month and year from the input string.
struct tm* datetime()
{


           time_t ts;
        struct tm *ct;


        ts = time(NULL);
        ct = localtime(&ts);
  • Function in algorithm to start calculating times.
int tsec1,tsec2,tsec3;
     tsec1 =  sec3;
      tsec1 += min3*60;
      tsec1 += (hour3*60)*60;
 tsec2 =  sec2;
      tsec2 += min2*60;
      tsec2 += (hour2*60)*60;

   tsec3 = tsec1 - tsec2 ;
   int secnd , minute ,hours;
   int secc , temp1,temp2,temp3,temp4 ;
      secnd = tsec3 % 60 ;
       temp1 = tsec3 - secnd ;
       temp2 = temp1/60 ;
       minute = temp2 % 60 ;
        temp4 = temp2 - minute ;
         hours = temp4 /60 ;
  • Function to deletes the data of the specified car from the array, if it is found
void car_delete ( struct car_management *v )
{
  int c ;

	parking_information[v -> car_row][v -> car_column] = 0 ;

	if ( v -> car_type == CAR )
    car_counting-- ;
  else
    tricycleCount-- ;

	vehicle_counting-- ;
	backward_upward();
}
  • The Function to get the row-col position for the vehicle to be parked.
void getting_free_column_row ( int car_type, int *arr )
{
  int r, c, fromrow = 0, torow = 2 ;

  if ( car_type == TRICYCLE )
  {
    fromrow += 2 ;
    torow += 2 ;
  }

	for ( r = fromrow ; r < torow ; r++ )
	{
		for ( c = 0 ; c < 10 ; c++ )
		{
			if ( parking_information[r][c] == 0 )
			{
				arr[0] = r ;
				arr[1] = c ;
        return ;
			}
		}
	}

	if ( r == 2 || r == 4 )
	{
   	arr[0] = -1 ;
    arr[1] = -1 ;
  }
}
  • Function to get the row-col position for the vehicle with specified number.
void getrcbyinfo ( int car_type, int car_number, int *arr )
{
  int r, c, fromrow = 0, torow = 2 ;

  if ( car_type == TRICYCLE )
	{
    fromrow += 2 ;
    torow += 2 ;
	}

	for ( r = fromrow ; r < torow ; r++ )
	{
		for ( c = 0 ; c < 10 ; c++ )
		{
			if ( parking_information[r][c] == car_number )
			{
				arr[0] = r ;
				arr[1] = c ;
        return ;
			}
		}
	}

	if ( r == 2 || r == 4 )
	{
		arr[0] = -1 ;
		arr[1] = -1 ;
	}
}
  • The Function to display list of vehicles parked.
void display_main_menu( )
{
  int r, c ;

  printf ( "Cars ->\n" ) ;

  for ( r = 0 ; r < 4 ; r++ )
  {
    if ( r == 2 )
		  printf ( "tricycle ->\n" ) ;

    for ( c = 0 ; c < 10 ; c++ )
      printf ( "%d\t", parking_information[r][c] ) ;
    printf ( "\n" ) ;
	}
}
  • Function to displays menu and calls corresponding functions.
system ( "cls" ) ;

		printf ( "\nCar Parking\n" ) ;
		printf ( "1. Arrival of a vehicle\n" ) ;
		printf ( "2. Total no. of vehicles parked\n" ) ;
		printf ( "3. Total no. of cars parked\n" ) ;
		printf ( "4. Total no. of tricycle parked\n" ) ;
		printf ( "5. Display order in which vehicles are parked\n" ) ;
		printf ( "6. Departure of vehicle\n" ) ;
		printf ( "7. Chek History\n" ) ;
		printf ( "8. Exit\n" ) ;

		scanf ( "%d", &choice ) ;
  • The Function to check for vehicle type.
while ( car_type != CAR && car_type != TRICYCLE )
          {
					  printf ( "Enter vehicle type (1 for Car / 2 for tricycle ): \n" ) ;
            scanf ( "%d", &car_type ) ;
	          if ( car_type != CAR && car_type != TRICYCLE )
						  printf ( "\nInvalid vehicle type.\n" ) ;
          }
  • Function to add cars’ data
 if ( car_type == CAR || car_type == TRICYCLE )
				  {
					  getting_free_column_row ( car_type, tarr ) ;

					  if ( tarr[0] != -1 && tarr[1] != -1 )
					  {
						  car_row = tarr[0] ;
						  car_column = tarr[1] ;

              if ( car_type == CAR )
                car[car_row][car_column] =  add ( car_type, number, car_row, car_column ) ;
              else
							  tricycle[car_row - 2][car_column] = add ( car_type, number, car_row, car_column ) ; ;
            }

Downloadable Source Code

Conclusion

This Car Parking System Project in C Language with Source Code is only a project made for school requirement purposes only. A Car Parking System Project in C language was created specifically for a semester project. It aims to give beginners a good understanding of programming small to large projects by imparting general workable and practical information about C. You can download this program and modify it to suit your client requirements, since this is a student project it means you cannot really expect 100% functionality from this.

Inquiries

If you have any questions or suggestions about Car Parking System Project in C Language Source Code, please feel free to leave a comment below.

2 thoughts on “Car Parking System Project in C Language with Source Code”

Leave a Comment