i am actually unable to understand if it's possible or not, to have conditional statements where there are three or more possible answers . And if so can it be done by using "if"and"else"?
That example of if else is just a couple statements. Not a complete program that one could compile. Therefore, no compiler has been used.
The syntax of the statements is valid on all modern compilers. The namespaces were described already 1990, but early compiler implementations did not have C++ Standard Library properly in namespace std. If your compiler does not accept std::cout, then update.
As Keskiverto mentioned the statements weren't compiled and were just meant to help you picture a scenario on usage, below I have added two more examples although compilable they achieve nothing interesting, i hope they will help you get a clearer picture.
#include <iostream>
struct A
{
constexpr A( int x, int y = 0 ) : x(x), y(y) {}
constexproperatorlonglong() const { return (longlong)x + y ; }
int x ;
int y ;
};
int main()
{
int a, b ;
std::cin >> a >> b ;
A cond(a,b) ;
constexpr A case_label(2) ;
switch(cond)
{
case case_label : std::cout << "A(2)\n" ; break ;
case A(5,6) : std::cout << "A(5,6)\n" ; break ;
default: std::cout << "default\n" ;
}
}
JSYK, in English that is a pretty gender-specific word, which would normally be passable in an online context, if only a little weird.
Except that your biggest help came from a feminine username... At which point it seems like you are being deliberately clueless or rude toward her after having already ignored her first very good answer...
For future reference, “sirs” works, but an informal “everyone” and some careful spelling does wonders: