c++ - Why is my cin is not working -
hello fsu student started programming , confused why cin not working. know code looks funny aren't allowed use lot of stuff yet while statements , such. posted code below. main question why after type cin >> quantity;
nothing happens in program.
cout << "-------------------------------------" << endl; cout << " florida state university" << endl; cout << " ticket information dept." << endl; cout << "-------------------------------------" << endl; cout <<""<< endl; cout <<""<< endl; cout << "please, enter name" << endl; cin >> name; cout << "how many florida state university credits have completed?" << endl; cin >> credits; if (credits <0) { cout<< "bad data recieved." << endl; } else { if (credits <=30) { ticketamt=2; cout <<name << ", eligible "<< ticketamt<< " tickets." << endl; } else if (credits <=60) { ticketamt=4; cout <<name << ", eligible "<< ticketamt<< " tickets." << endl; } else if (credits <=90) { ticketamt=6; cout <<name << ", eligible "<< ticketamt<< " tickets." << endl; } else { ticketamt=8; cout <<name << ", eligible "<< ticketamt<< " tickets." << endl; } cout << "are florida resident? enter (y)es or (n)o" << endl; cin >> resident; if (resident !='y'||resident !='y'||resident !='n'||resident !='n') { if (resident=='y'||resident=='y') { tixprice=75; } else if (resident=='n'||resident=='n') { tixprice=95; } cout << "each ticket costs $" <<tixprice<< endl; cout << "how many want?" << endl; cin >> quantity; if (quantity >ticketamt||quantity <0) { cout << "bad data -> number of tickets desired not in range" << endl; } else { totalprice = tixprice * quantity; } } else { cout << "bad data recieved" << endl; } }
Comments
Post a Comment