Switch ERROR

Hello. I was trying to make a program using switch case. I got an error-

1) switch selection expression must be of integral type in main function().

Program link- http://pastebin.com/CXuYNbSf

Help me!
natarajadithyan.
You know you can just copy and paste it on here lol?

EDIT: the code, I mean.
Last edited on
closed account (o3hC5Di1)
Hi there,

I got your program to compile by changing the first 5 lines of the program to:

1
2
3
4
5
6
 #include <iostream>  //iostream.h could not be found  on my system
    using namespace std;  //have to use this or do std::cout, std::cin, etc.
    int main()   //main must return an int, not void
    {
      int i;    //switch construct can only take integers, not floats
      float a,b;


Hope that helps.

All the best,
NwN
Topic archived. No new replies allowed.