Error

1
2
3
4
5
6
7
8
9
10
11
12
13
14
 if (choice3 == 1)
     {
	string find;
	cout<< "Enter the registration no: "<< find;
	
	   for(int i=0; i<sc_count;i++)
    { 
	 if (sportcars_Arry[i]. car_registration == find)
      sportcars_Arry[i].displaysports_cars();
	   else{
		  cout<< "No sports car exists with the specified registration number ...!!!";
		}
         }
    }


Each time i run this and it comes to the enter registration no: it just finishes the program what am i doing wrong?
1
2
string find;
cout<< "Enter the registration no: "<< find;

This will print "Enter the registration no: " followed by the value of find. find is empty so nothing is printed. Do you want to read a string from std::cin and put it in find?
1
2
3
string find;
cout<< "Enter the registration no: ";
cin >> find;
Last edited on
basically its a car rental system and the user has typed in the car registration number and this will find that car which the user has typed in thought im stuck as it will not let me enter the number.
Topic archived. No new replies allowed.