CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2001
    Posts
    74

    c++ issue(urgent)

    Rone is float.

    cout << "Enter R1 of Delta Network" <<"\n";
    cin >> Rone;
    if(Rone>0)
    {
    }
    else
    {
    cout<< "R1 does not accept zero ,negative and character values";
    cout << "Enter R1 of Delta Network" <<"\n";
    cin >> Rone;
    }


    My mistake if i press any character it's going into the loop.It's not stopping.How to solve this problem.

    Thanks and regards,
    Mala

  2. #2
    Join Date
    Sep 2003
    Location
    San Diego
    Posts
    190
    What loop?
    Please give us more details!

  3. #3
    Join Date
    Jul 2002
    Location
    St. Louis, MO
    Posts
    484
    Characters have a numeric value that is > 0.

    For instance:
    'A' == 0x41
    'B' == 0x42

  4. #4
    Join Date
    Apr 2001
    Posts
    74
    loop means
    again and again The below message are displaying.
    Messages("R1 does not accept zero ,negative and character values ,Enter R1 of Delta Network")

    It's going to line1 and line2 .It's not going to line no 3.If it's goes only i can enter the input again.

    line1,
    cout<< "R1 does not accept zero ,negative and character values";
    line2,
    cout << "Enter R1 of Delta Network" <<"\n";
    line3,
    cin >> Rone

    How to stop this message and give input to cin >>Rone

    Thanks and regards,
    Mala

  5. #5
    Join Date
    Apr 2003
    Posts
    893
    Originally posted by malab
    loop means
    again and again The below message are displaying.
    Messages("R1 does not accept zero ,negative and character values ,Enter R1 of Delta Network")

    It's going to line1 and line2 .It's not going to line no 3.If it's goes only i can enter the input again.

    line1,
    cout<< "R1 does not accept zero ,negative and character values";
    line2,
    cout << "Enter R1 of Delta Network" <<"\n";
    line3,
    cin >> Rone

    How to stop this message and give input to cin >>Rone

    Thanks and regards,
    Mala
    Can you post your loop code snippet, the one which uses while/for or something similar to loop your messages around...(*)

    Regards,

    Fiona

    @Edit@ I forgot to include
    Last edited by hometown; October 21st, 2003 at 06:13 PM.

  6. #6
    Join Date
    Dec 2002
    Posts
    1,050
    Plenty of previous threads about this topic. Heres one. Maybe it'll
    help.
    http://www.codeguru.com/forum/showth...light=cin.fail

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured