Created
September 21, 2014 23:27
-
-
Save ehsanmasdar/5c322fd99ca2dc2045b6 to your computer and use it in GitHub Desktop.
My first project, learning C!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//what commands to include (header) | |
#include <iostream> | |
//using standard library | |
using namespace std; | |
//function main, returns intiger | |
int main() | |
//start program | |
{ | |
//C Out \n=new line | |
cout << "Hello world!\n"; | |
//Reads imput4, expects return key | |
int number; | |
cout << "Enter a Number,0-9\n" ; | |
cin>> number; | |
cin.ignore(); | |
if ( number==0 ) { | |
cout<<"0 is a valid input :D\n"; | |
} | |
if ( number==1 ){ | |
cout<< number << " is a valid input :D\n"; | |
} | |
if ( number==2 ){ | |
cout<< number << " is a valid input :D\n"; | |
} | |
if ( number==3 ){ | |
cout<< number << " is a valid input :D\n"; | |
} | |
if ( number==4 ){ | |
cout<< number << " is a valid input :D\n"; | |
} | |
if ( number==5 ){ | |
cout<< number << " is a valid input :D\n"; | |
} | |
if ( number==6 ){ | |
cout<< number << " is a valid input :D\n"; | |
} | |
if ( number==7 ){ | |
cout<< number << " is a valid input :D\n"; | |
} | |
if ( number==8 ){ | |
cout<< number << " is a valid input :D\n"; | |
} | |
if ( number==9 ){ | |
cout<< number << " is a valid input :D\n"; | |
} | |
if ( number-272==1 ) { | |
cout<< "You got the secret code!\n"; | |
goto A; | |
} | |
if ( number>9 ) { | |
cout<< "Not a valid imput\n"; | |
} | |
if ( number<0 ) { | |
cout<< "Not a valid imput\n"; | |
} | |
A: | |
cin.get(); | |
//outputs code one after program run | |
return number ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment