if statement

I'm trying to write if statement.
But it comes out shows "[ _Elem=char,_Traits=std::char_traits<char>]
Here's what I write.
Thanks a lot.

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
    cout << "Please enter your high(cm)" ;
  cin >> height;
  cout << " 1.convert KG into IN  2.convert IN into KG " ;//unfinish
  cin >> ope;
  cout << "Please enter your weight : " ;
  
  
  if (ope == 2)
  {
 //input goal
	cin >> weightlb;
	weightkg = weightlb / (2.2);
	cout << "Your weight is ";
	cout.setf(ios::fixed|ios::showpoint);
	cout << setprecision(2);
	cout << weightkg << "(kg)" << endl;
  }
  else (ope == 1)
  {
	cin >> weightkg;
	weightlb = weightkg*(2.2);
	cout << "Your weight is ";
	cout.setf(ios::fixed|ios::showpoint);
	cout << setprecision(2);
	cout << weightlb << "(lb)" << endl;
  }	
 
  //calculation
  
  double bmi = weightkg / pow(height, 2);
  double goal = weightlb - 107.8;
 
 //output
  
  
     //formatting output 
  
  cout << "Your BMI is " << bmi << endl;
  cout << "You still have to loss " << goal << endl;
line 18: else if(ope == 1)
Hello,
as coder777 mentioned, you have to put an if after else,
but if you want to just use else, you can use it but you have to write a error handling statement as well for numbers other than 1 and 2.

regards
Topic archived. No new replies allowed.