0
Write a c++ program. Make sure your program handle all validations, use at least one class.z1,2,3,4 =±x /(±y).
#include <cstdlib> #include <iostream> #include <math.h> using namespace std; class Coding{ private: double x , y ; double z1 , z2 , z3 , z4; public: }; void Coding:: display(){ cout << "Enter a value for x \n"; cin >> x; cout << "Enter a value for y \n"; cin >> y; if(y == 0){ z1 = (x / y); z2 = (-x) / (-y); z3 = (-x) / (y); z4 = (x) / (-y); cout<<"The answer for z1 = "<<z1<<" and z2 ="<<z2<<endl; cout<<"The answer for z3 = "<<z3<<" and z4 ="<<z4<<endl; } else{ cout<<"Error! Check Your Values"<<endl; } } int main(){ Coding myCoding; myCoding.display(); } Please I Need Helping Hand 👆. I'm Getting An Error At Where The Void Coding:: Display Is. Someone Should Help Me Out
1 Odpowiedź
0
Include this in class after public:
void display();