| iValue (1) | |
|
#include <iostream> #include "conio.h" using namespace std; void main(){ int a,b,c,result; cout << "Enter Number to Count From: " << endl; cin >> a; if(a<=0){ cout << "Invalid"; } else { cout << "Enter Number to Count To: " << endl; cin >> b; _getch(); } I am coming to C++ from having a Java experience. I know both are similar to one another, but I am having trouble with the if statement, if that's even what's going on here. I am trying to make this what I made in Java, a counter that lets the user choose a number to count from, and a number to count to. I was just testing this code (not done) and it doesn't work, like if the user inputs 0 or less, it just moves on, ignoring the if statement. Anyone know why? Can anyone help my code I am working on? | |
|
|
|
| homi (96) | |
Please use source code format :) | |
|
|
|
| homi (96) | |||
| |||
|
Last edited on
|
|||