Click here to Skip to main content
15,798,592 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: what is equivelent of Inet1.OpenURL in visual c++ 6 Pin
method00712-Jul-06 13:14
method00712-Jul-06 13:14 
QuestionUser Input revisted 2 [modified] Pin
Harold_Wishes12-Jul-06 6:02
Harold_Wishes12-Jul-06 6:02 
QuestionRe: User Input revisted 2 Pin
David Crow12-Jul-06 6:17
David Crow12-Jul-06 6:17 
AnswerRe: User Input revisted 2 [modified] Pin
Harold_Wishes12-Jul-06 6:39
Harold_Wishes12-Jul-06 6:39 
GeneralRe: User Input revisted 2 Pin
David Crow12-Jul-06 6:53
David Crow12-Jul-06 6:53 
GeneralRe: User Input revisted 2 [modified] Pin
Harold_Wishes12-Jul-06 7:12
Harold_Wishes12-Jul-06 7:12 
GeneralRe: User Input revisted 2 Pin
David Crow12-Jul-06 7:33
David Crow12-Jul-06 7:33 
GeneralRe: User Input revisted 2 Pin
Zac Howland12-Jul-06 11:12
Zac Howland12-Jul-06 11:12 
You are doing far too much work for this.

// assume min and max are included in range
int getInput(int range_min, int range_max)
{
        int ret = range_min - 1;        // initialized to a invalid entry
        do
        {
                char buffer[100] = {0};
                cout << "Enter a value:  ";
                cin.getline(buffer, 99, '\n');
                ret = atoi(buffer);
                if (range_min > ret || ret > range_max)
                {
                        cout << "Invalid entry!" << endl;
                }
        } while (range_min > ret || ret > range_max);

        return ret;
}

int main()
{
	int count = getInput(1, 11);
	cout << "You entered:  " << count << endl;
}


If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac
GeneralRe: User Input revisted 2 [modified] Pin
earl12-Jul-06 9:52
earl12-Jul-06 9:52 
GeneralRe: User Input revisted 2 [modified] Pin
Harold_Wishes12-Jul-06 11:04
Harold_Wishes12-Jul-06 11:04 
Questionpthread Pin
mehmetned12-Jul-06 5:55
mehmetned12-Jul-06 5:55 
AnswerRe: pthread Pin
toxcct12-Jul-06 5:58
toxcct12-Jul-06 5:58 
GeneralRe: pthread Pin
led mike12-Jul-06 6:02
led mike12-Jul-06 6:02 
AnswerRe: pthread Pin
David Crow12-Jul-06 5:58
David Crow12-Jul-06 5:58 
AnswerRe: pthread Pin
led mike12-Jul-06 6:05
led mike12-Jul-06 6:05 
AnswerRe: pthread Pin
Jun Du12-Jul-06 6:08
Jun Du12-Jul-06 6:08 
Questionoverzealous protection rules Pin
Dave Schumann12-Jul-06 5:53
Dave Schumann12-Jul-06 5:53 
AnswerRe: overzealous protection rules Pin
toxcct12-Jul-06 5:56
toxcct12-Jul-06 5:56 
GeneralRe: overzealous protection rules Pin
Dave Schumann12-Jul-06 6:02
Dave Schumann12-Jul-06 6:02 
AnswerRe: overzealous protection rules Pin
Dave Kerr12-Jul-06 5:59
Dave Kerr12-Jul-06 5:59 
GeneralRe: overzealous protection rules Pin
Christian Graus12-Jul-06 6:00
protectorChristian Graus12-Jul-06 6:00 
GeneralRe: overzealous protection rules Pin
toxcct12-Jul-06 6:05
toxcct12-Jul-06 6:05 
GeneralRe: overzealous protection rules Pin
Dave Kerr12-Jul-06 6:08
Dave Kerr12-Jul-06 6:08 
GeneralRe: overzealous protection rules Pin
Dave Schumann12-Jul-06 6:29
Dave Schumann12-Jul-06 6:29 
GeneralRe: overzealous protection rules Pin
Dave Schumann12-Jul-06 6:04
Dave Schumann12-Jul-06 6:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.