What is the problem in here? When I execute the code, it prints the model variable before I input the manufacturingCompany variable.
#include <iostream>
using namespace std;
class Smartphone{
public:
string manufacturingComapny, model, screenType;
int price, batteryCapacity;
Smartphone(){
cout << "Enter model: ";
getline(cin, model);
cout << "Enter screen type: ";
getline(cin, screenType);
cout << "Enter battery capacity: ";
cin >> batteryCapacity;
cout << "Enter price: ";
cin >> price;
cout << "Enter manufacturing company: ";
getline(cin, manufacturingComapny);
cout << model << endl;
cout << screenType << endl;
cout << batteryCapacity << "mA"<< endl;
cout << price << "$" << endl;
cout << "Made by " << manufacturingComapny << endl;
}
};
int main(){
Smartphone phone1;
}