Try something like:
if (condition 1)
{}
else if (condition 2)
{}
else
{}
Advice! Take time to learn properly the language.
Here is links to references books on C and C++ by the authors of the languages. Note than C is the ancestor of C++, so knowing C is always useful with C++.
The C Programming Language - Wikipedia, the free encyclopedia[
^]
https://hassanolity.files.wordpress.com/2013/11/the_c_programming_language_2.pdf[
^]
http://www.ime.usp.br/~pf/Kernighan-Ritchie/C-Programming-Ebook.pdf[
^]
C++ Programing Language[
^]
[UpDate]
Quote:
i already know the thing you provided but i want to write the case statement as below
or moreover in place of case 1 i want case if(conditional expression)
It does not exist in the language !
[UpDate]
Quote:
I want to optimize the below code using switch case statement.
i have already written this code.
if (i % 3 == 0 && i % 5 == 0)
{
Console.WriteLine("Both True");
}
if (i % 3 == 0)
{
Console.WriteLine("Three True");
}
if (i % 5 == 0)
{
Console.WriteLine("Five True");
}
You can't ! it is already optimized !