i had my practical test for C++ and i have no idea why i cant go to "else if('E') and also for else if 'n' condition and there is a warning sign there said uninitialized local variable 'E' and 'n'.
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int weight,distance;
double rate,total;
char N,E,y,n;
cout<<"Program will determine the total cost based on distance and weight"<<endl;
cout<<"Please enter weight in kg:"<<endl;
cin>>weight;
cout<<"Please enter the distance:"<<endl;
cin>>distance;
cout<<"Please enter the type of post (N/E)"<<endl;
cin>>N || E;
if('N')
{
if(weight>=1 && weight<=5)
{
if(distance>=1 && distance<=99)
rate = 1.20;
I think maybe you intended to use if(E) instead of if('E'). if(E) checks the information stored in the variable with the name E, whereas if('E') refers to the literal 'E'.
Also, please use the code tags when posting code, it makes it way easier to read and provides line numbers. To do that, use the Format button for code when you are posting