Function

What is wrong with this?

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
// gascheck.cpp

#include <iostream>
using namespace std;
// function prototypes

char print_warning( char a);
print_warning = "Warning"

char print_okay(char b)
b = okay;
using namespace std;
int main()
 {
  double miles_remaining, fuel_remaining, mpg, fuel_miles;

  cout << "How many miles are you from the next gas station? ";
  cin >> miles_remaining;
  cout << "How much fuel do you have left (in gallons)? ";
  cin >> fuel_remaining;
  cout << "What is your average miles to the gallon? ";
  cin >> mpg;

  fuel_miles = fuel_remaining * mpg;
  if (fuel_miles< miles_remaining)
  { 
	  cout << a << endl;
  }
  else 
  {
	  cout << b << endl;






  return 0;
 } // end of main function 

Last edited on
The closing curly brace of the else block is missing.

1
2
3
4
5
char print_warning( char a);
print_warning = "Warning"

char print_okay(char b)
b = okay;


That's not how a function looks like in C++.
http://cplusplus.com/doc/tutorial/functions/
Topic archived. No new replies allowed.