C++: Else-If Loop

If - Else - Else If Loop in C++. Source code is below and attached.
#include <iostream>
#include <string>
using namespace std;
int main()
{ // start main function
string linuxDistribution;
cout << "Enter Linux distribution: ";
cin >> linuxDistribution;
if (linuxDistribution == "Debian")
{
cout << "Debian uses apt-get.";
} // end if
else if (linuxDistribution == "Fedora")
{
cout << "Fedora is part of Red Hat.";
} // end else if
else if (linuxDistribution == "OpenSuse")
{
cout << "OpenSuse uses Yast.";
} // end else if
else if (linuxDistribution == "Kali")
{
cout << "Kali is a security distribution.";
} // end else if
else if (linuxDistribution == "Slackware")
{
cout << "Slackware is an advanced Linux system.";
} // end else if
else if (linuxDistribution == "Arch")
{
cout << "Arch uses 'pacman'.";
} // end else if
else
{
cout << "There are over 300 Linux distributions!";
} // end else
return 0;
} // end main function
Downloads
Supplies



- Code::Blocks IDE for C++
- Computer

If - Else - Else If Loop in C++. Source code is below and attached.
#include <iostream>
#include <string>
using namespace std;
int main()
{ // start main function
string linuxDistribution;
cout << "Enter Linux distribution: ";
cin >> linuxDistribution;
if (linuxDistribution == "Debian")
{
cout << "Debian uses apt-get.";
} // end if
else if (linuxDistribution == "Fedora")
{
cout << "Fedora is part of Red Hat.";
} // end else if
else if (linuxDistribution == "OpenSuse")
{
cout << "OpenSuse uses Yast.";
} // end else if
else if (linuxDistribution == "Kali")
{
cout << "Kali is a security distribution.";
} // end else if
else if (linuxDistribution == "Slackware")
{
cout << "Slackware is an advanced Linux system.";
} // end else if
else if (linuxDistribution == "Arch")
{
cout << "Arch uses 'pacman'.";
} // end else if
else
{
cout << "There are over 300 Linux distributions!";
} // end else
return 0;
} // end main function