AndreiL
Welcome to AndreiL.
Enjoy your time.
Please log in.

Simple console interface - C++

Go down

Simple console interface - C++

Post by Lucaci Andrei on Tue Mar 06, 2012 2:05 am

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* cn.cpp
* cn.cpp is licensed under GNU GENERAL PUBLIC LICENSE
* Created on: Mar 6, 2012
* Author: sin
*/
#include<iostream>
#include<string>
#include<string.h>
using namespace std;

/*Printing first option
* of the program.
*/
int one(){
cout<<"1 - Good work, you chose option 1.\n";
return 0;
}
/*Printing the
* second part
* of the program.
*/
int two(){
cout<<"2 - Good work, you chose option 2.\n";
return 0;
}

/*The main function
* which withholds
* the menu.
*/
int main(){
string answer;
answer="unu";
cout<<"Choose between: \n 1. Print 1 \n or \n2. Print 2\n";
while (answer!="exit"){
cout<< "Choose: ";
cin>>answer;
if (answer=="1" or answer=="1."){
one();
}
else if (answer=="2" or answer=="2."){
two();
}
else if (answer=="exit"){
cout<<"Initialized exit()";
}
else{
cout<<"\nInvalid command.\n";
}
}
return 0;
}

avatar
Lucaci Andrei
"Tata Lor"


Number of messages : 222
Points : 2266743
Reputation : 1007
Registration date : 2008-08-15
Age : 25
Location : Cluj-Napoca

View user profile http://www.andreil.wgz.ro

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum