|
-
October 21st, 2013, 06:06 PM
#1
If else statement displaying both options.
Hi, I am new to coding and have a question with my if else statement. This is a VERY simple program that I have made something like in Javascript before, but when I do it in C++ it does not work correctly. It displays both the options. Here is my code.
// Practice.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
// Asking for a number
{
int x;
cout << "Give me a number.";
cin.ignore();
cin >> x;
if (x < 25)
{
cout << "That is a small number.";
}
else (x >= 25);
{
cout << "That is a big number!";
}
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|