Return 0

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <cstdlib>
#include <iostream>


using namespace std;
//funkcijos
int a();
int b();
int c();
int d();
int e();
int f();
int g();
int h();
int i();
int j();
int k();
int l();
//funkcijos
//meniu

int main (void)
{
    //pristatymas
    cout <<"This is a currency converter.It helps to convert 4 currencies between."<<endl;
    cout << endl;
    cout << endl;
    //pristatymas
// pasirinktys	
    char ch;
	cout <<"Please select one of the currencies."<<endl; 
	cout <<"Select a letter and press enter"<<endl;
    cout << endl; 
    cout <<"a > EUR-LT,b > USD-LT,c > GBP-LT"<<endl;
    cout << endl;
	cout <<"d > LT-EUR,e > LT-USD,f > LT-GBP"<<endl;
	cout << endl;
	cout <<"g > EUR-USD,h > EUR-GBP,i > GBP-EUR"<<endl;
	cout << endl;
	cout <<"j > USD-EUR,k > GBP-USD,l > USD-GBP"<<endl;
	cout <<endl;
    cout <<"If you want to finish type # and press enter."<<endl;
	while ((ch=getchar())!='#')
	{
		if(ch!=' ')
		switch(ch)
		{
			case 'a':cout << "EUR-LT\n" << endl;cout << a();
				break;
			case 'b':cout << "USD-LT\n" << endl;cout << b();
				break;
			case 'c':cout << "GBP-LT\n" << endl;cout << c();
				break;
			case 'd':cout << "LT-EUR\n" << endl;cout << d();
				break;
			case 'e':cout << "LT-USD\n" << endl;cout << e();
				break;
            case 'f':cout << "LT-GBP\n" << endl;cout << f();
				break;   
            case 'g':cout << "EUR-USD\n" << endl;cout << g();
				break;
            case 'h':cout << "EUR-GBP\n" << endl;cout << h();
				break;
            case 'i':cout << "GBP-EUR\n" << endl;cout << i();
				break;
            case 'j':cout << "USD-EUR\n" << endl;cout << j();
				break;
            case 'k':cout << "GBP-USD\n" << endl;cout << k();
				break;
            case 'l':cout << "USD-GBP\n" << endl;cout << l();
				break; 	
				
		}
		else
			cout << "You have pressed space button , if you want to continue enter a letter or enter # to finish\n"<<endl;
	}
}
// pasirinktys
//meniu
//Euro skaiciavimas
int a()
{
    
  double a,b,c;
  c=3.4420 ;
cout << "Enter EUR amount\n" << endl;
cin >> a;
cout << endl;
b=a*c ;
cout << a << "EUR is " << b <<"LT"<<endl;
cout << endl;
cout << endl;
cout << endl;
return 0 ;
}

It's a currency converter.
I didn't post a full program , cos it's the same later on.
I have a problem:
When I choose something from my programs menu , I write a number , and it counts , this part works , but at the end I get a number 0 , it's like return 0; and it returns , how should I hide the 0?
Last edited on
On line 48: cout << a(); You're printing the return value of a(). If you just want to call a(), simply use a();. However, the correct way of doing it would be to get the value in main, do the operation in the function, and then return the converted value.
By the way, if you have nothing to return, just declare the function's return value as void, and omit the return.
Thx , that solved my problem
Topic archived. No new replies allowed.