// ConsoleApplication31.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include<conio.h>
using namespace std;
class complex
{
private:
float real;
float imag;
public:
void getdata(float a, float b)
{
real = a;
imag = b;
}
void display()
{
cout << real << " +j" << imag << "\n";
}
};
void main()
{
complex *p;
p = new complex;
int x, y;
cout << "enter two number: ";
cin >> x >> y;
p->getdata(x,y);
cout << "\n the complex number is : ";
p->display();
_getch();
}
//
#include "stdafx.h"
#include<iostream>
#include<conio.h>
using namespace std;
class complex
{
private:
float real;
float imag;
public:
void getdata(float a, float b)
{
real = a;
imag = b;
}
void display()
{
cout << real << " +j" << imag << "\n";
}
};
void main()
{
complex *p;
p = new complex;
int x, y;
cout << "enter two number: ";
cin >> x >> y;
p->getdata(x,y);
cout << "\n the complex number is : ";
p->display();
_getch();
}
0 التعليقات:
إرسال تعليق