so this code is for a car garage, filling info of the accepted cars to be repaired everyday. and print the result for each car in a line.
i have two problems with my code. first is, starting the second time the "do...while... " loop runs, i cant have an input for "enter car name" second is the final output, i want it in straight neat lines but can't !
I'll be so grateful if someone gives me the edited and fixed version of my code!
#include <iostream>
using namespace std;
int D; //are you done?
int main()
{
int i = 0; //counting cars
string cars[10][7] = {};
string C = cars[i][1]; //car name
string N = cars[i][2]; //owner name
string Y = cars[i][3]; //car production year
string R = cars[i][4]; //car color
string K = cars[i][5]; //car life in km
string M = cars[i][6]; //car problem
string H = cars[i][7]; //time of arrival
do {
i++;
cout << endl;
cout << " enter car name ";
getline(cin, cars[i][1]);
cout << endl;
cout << " enter owner name ";
getline(cin, cars[i][2]);
cout << endl;
cout << " enter production year ";
getline(cin, cars[i][3]);
cout << endl;
cout << " enter car color ";
getline(cin, cars[i][4]);
cout << endl;
cout << " enter car life in km ";
getline(cin, cars[i][5]);
cout << endl;
cout << " enter car problem ";
getline(cin, cars[i][6]);
cout << endl;
cout << " enter time of arrival ";
getline(cin, cars[i][7]);
cout << endl;
cout << "this was car :" << i << endl;
cout << endl;
cout << "type '1' to continue. type '2' if you are done." << endl;
cin >> D;
} while (D == 1);
cout << endl << "ended ! here is today's list of cars :";
cout << endl;
cout << endl;
for (i = 0; i < 20; i++) {
for (int j = 0; j < 7; cout << "\t" << cars[i][j] && j++);
{
}
cout << endl;
}
return 0;
}