CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13

Thread: Help a newbi

Threaded View

  1. #1
    Join Date
    Apr 2010
    Posts
    60

    Help a newbi

    Ok so i'm trying to write something very simple, I'm a complete newbi.

    #include <iostream>

    using namespace std;

    int age;
    char answer;

    int main()
    {
    cout << "Hello, And welcome to my Quiz, This is just a basic Program\n\n";
    system("PAUSE");
    system("CLS");

    cout << "Please enter your Age\n";
    cin >> age;
    cout << "So you are " << age << " Years old?, Y/N \n";
    cin >> answer;
    if(answer == "Y" || answer == "y")
    {
    cout << "Ok ";
    }

    system("PAUSE");
    }

    If you press N i wan't it to go Back to where you enter your age, How do i send it back to that line?, Or do i just ask the question again?
    Last edited by UpcomingChris; November 20th, 2011 at 06:09 PM.

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