Umm I created a code which will create many results with specific ints(integers).I use Code::Blocks as my compiler.The code works inside the compiler,but when I go to the saved folder and run the batch file this is what happens-I enter a number and press enter and it simply closes itself!@What's wrong?

#include <iostream>

using namespace std;

int main()
    int thisisanumber;

    cout<<"Give me a number: ";
    if ( thisisanumber == 80 || thisisanumber == 13 ) {
        cout<<"How did you?!... ";
    else if ( thisisanumber == 7 || thisisanumber == 11 ) {
        cout<<"Awesomeness controls you and you control awesomeness!";
    else if ( thisisanumber == 9 || thisisanumber == 14 ) {
        cout<<"Pretty good!";
    else if ( thisisanumber == 15 || thisisanumber == 55 ) {
        cout<<"Not bad nor good.";
    else if ( thisisanumber == 22 || thisisanumber == 43 ) {
    else if ( thisisanumber == 43 || thisisanumber == 33 ) {
        cout<<"You need to improve the part of your brain-RANDOMNESS!";
    else if ( thisisanumber == 69 || thisisanumber == 49 ) {
        cout<<"Go visit a random doctor.";
    else {
        cout<<"Even the word BAD would feel ashamed to go to you!";

Reply quickly guys.

Signing off,

Sorry,my mistake.I forgot to put


.It is solved.Sorry.

Signing off,

Your pause at the end isn't really pausing because there's extraneous characters in the stream. Specifically, when reading an integer, the [Enter] key you pressed will remain in the stream for cin.get() to read later. You'll find that if you call cin.get() a second time, it'll work as intended, which highlights the issue quite well.

Hey Narue,
Thanks a lot,but isn't the problem that I forgot to put


on line 11.Reply,because I'm actually just a beginner at C++.

And I learn from this site called I am on lesson 4,functions and I can't understand a word they are saying.Reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.