Validation problem

can anyone help me out with my coding? im new to c++ and need a lot of guidance

here is my code:


#include "LocationData.h"
#include <cctype>
#include <iostream>
#include <sstream>
#include <fstream>
#include <cstring>
#include <string>
#include <cstdlib>

LocationData::LocationData() {
}

LocationData::LocationData(const LocationData& orig) {
}

LocationData::~LocationData() {
}

using namespace std;

void LocationData::Entry() {

int x, y, noPlanets, noMoon;
string sunType;
char cfm;
float aveParticulateDensity, avePlasmaDensity;

cout << "[Input statistical data]" << endl;

do {
cout << "Please enter x-orinate: ";
cin.clear();
cin >> x;
if (!(x) x > 10 || 0 < x) {

cout << "Please enter only enter numbers only" << endl;
cout << "Press 'Y' to continue and 'X' to exit" << endl;
cin >> cfm;
cin.clear();
cin.ignore(100, '\n');
} else {
break;
}

if (cfm == 'n' || cfm == 'N') {
exit(0);
} else if (cfm != 'Y' && cfm != 'y' && cfm != 'n' && cfm != 'N') {
exit(0);
}
} while (cfm == 'y' || cfm == 'Y');


i wanna make the user key in x-ordinate again if he enter y or Y... but it keeps exit the program.. anyone can help me.. pardon me for my ignorance...
hi, why don“t you use breakpoints and step by step execution of your code? that should reveal what the problem is.
Topic archived. No new replies allowed.