Hi can anyone help me with my enrollment project? Program that I wrote stops after user input, and I don't have any idea why this is happening. User must input a 10 digit number or below but after that the program exits. Why my program ends after I input application number less than or equal to 10? please need help
#include <iostream>
#include <string>
using namespace std;
void enter_details()
{
int x;
char name[30];
long application_number;
char address[50];
int age, day, month, year;
string monthName;
string branch;
//student details
cout << "Enter Name: ";
cin.get(name,30);
while(1)
{
cout << "Enter application number: ";
cin >> application_number;
if(application_number<=9999999999)
break;
}
cout << "Enter adress: ";
cin.get(address,50);
cout << "Enter age: ";
cin >> age;
cout << "Enter birthday: mm dd yyyy : ";
cin >> month >> day >> year;
cout << "Select Program: "<<endl;
cout << "1 for Civil Engineering"<<endl;
cout << "2 for Chemical Engineering"<<endl;
cout << "3 for Electrical Engineering"<<endl;
cout << "4 for Electronics Engineering"<<endl;
cout << "5 for Industrial Engineering"<<endl;
cout << "6 for Mechanical Engineering"<<endl;
cin >> x;
// Display numeric month in words
switch (month)
{
case 1: monthName="January";
break;
case 2: monthName="February";
break;
case 3: monthName="March";
break;
case 4: monthName="April";
break;
case 5: monthName="May";
break;
case 6: monthName="June";
break;
case 7: monthName="July";
break;
case 8: monthName="August";
break;
case 9: monthName="September";
break;
case 10: monthName="October";
break;
case 11: monthName="November";
break;
case 12: monthName="December";
break;
default: cout << "Please input a valid date ";
break;
}
//Display inputed data
cout <<endl;
cout << "Entered Details:"<<endl;
cout << "Name: "<<name<<endl;
cout << "Application Number: "<<application_number<<endl;
cout << "Address: "<<address<<endl;
cout << "Age: "<<age<<endl;
cout << monthName<<" "<<day<<","<<year<<endl;
//Program selection
switch (x)
{
case 1: branch="Civil Engineering";
cout << "College of "<<branch<<endl;
break;
case 2: branch="Chemical Engineering";
cout << "College of "<<branch<<endl;
break;
case 3: branch="Electrical Engineering";
cout << "College of "<<branch<<endl;
break;
case 4: branch="Electronics Engineering";
cout << "College of "<<branch<<endl;
break;
case 5: branch="Industrial Engineering";
cout << "College of "<<branch<<endl;
break;
case 6: branch="Mechanical Engineering";
cout << "College of "<<branch<<endl;
break;
default: cout << "invalid option"<<endl;
break;
}
}
//call funtions
int main()
{
cout << "Enter Student Details"<<endl;
enter_details();
}