CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2010
    Posts
    2

    HELP! need assistance on C++ project

    Ok so I have a C++ project due tomorrow and I am stuck. I am also a completely new to C++ and programming in general so if you can tell me the necessary code and where to put it it would help ALOT.

    #include "stdafx.h"
    #include <iostream>
    using namespace std;

    int main()
    { int i;
    i = 1;

    cout << "Wanna test how smart you are? \n";
    cout << "ThEn LeT's PlAy ThE sMaRt GaMe! \n";
    cout << "What's "<<i<<"*"<<i<<"? \n";
    int guess;
    cin >> guess;
    int num;
    num = (i+1)*(i+1);
    if (guess == num);
    cout << "WoW! i NeVeR tHoUgHt YoU wErE sO sMaRt! \n";
    cout << "TIME FOR LEVEL "<<i<< " ! \n";
    cin.get()
    return 0}

    I am using the basic header files with Visual Studio '10. Basically, what I want this program to do is play this code but i want it to have a loop that adds 1 to integer i after every time it loops (it will loop continuously). I also want an else if statement that will send the player back to level one and resets the integer i back to 1, and repeat the process. Any help will be greatly appreciated.

  2. #2
    Join Date
    May 2006
    Location
    Indonesia & Japan
    Posts
    399

    Re: HELP! need assistance on C++ project

    Use while(true) for infinite loop
    henky
    ----------------------------------
    henky@nok.co.id is not my email address anymore...
    Jangan Pernah Menyerah

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