### electric circuit theory viva questions for lab

in parallel resonace, the current is- a)0 b)min c)max d)half of max 2) in series resonace, power factor becomes a)infinite b)0 c)1 d)1/2 3)if we […]

in parallel resonace, the current is- a)0 b)min c)max d)half of max 2) in series resonace, power factor becomes a)infinite b)0 c)1 d)1/2 3)if we […]

Write a program to compare the magnitude of a complex number by overloading the <,>,==,!= operator.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
#include<iostream> using namespace std; class money { int rupees,paisa; public: void input() { cout<<"enter values of rupees and paisa"; cin>>rupees>>paisa; } void display() { cout<<"rupees="<<rupees<<"paisa="<<paisa; } int operator >(money m) { float mag1=rupees+paisa/100; float mag2=m.rupees+m.paisa/100; if(mag1>mag2) { return 1; } else { return 0; } } int operator <(money m) { float mag1=rupees+paisa/100; float mag2=m.rupees+m.paisa/100; if(mag1<mag2) { return 1; } else { return 0; } } int operator !=(money m) { float mag1=rupees+paisa/100; float mag2=m.rupees+m.paisa/100; if(mag1!=mag2) { return 1; } else { return 0; } } int operator ==(money m) { float mag1=rupees+paisa/100; float mag2=m.rupees+m.paisa/100; if(mag1==mag2) { return 1; } else { return 0; } } }; int main() { money m1,m2; m1.input(); m2.input(); m1.display(); m2.display(); if(m1>m2) { cout<<"money is greater of the first one"; } if(m1<m2) { cout<<"first money was loss"; } if(m1!=m2) { m1.operator!=(m2); cout<<"it is not equal"; } if(m1==m2) { cout<<"equal"; } return 0; } |

Its output will come as follows. Explanation now […]

Operator overloading. We have used the existing operators such as +,-,*,and / with the fundamental data types. Fundamental data types are int,float,etc datatypes. And in […]

i will grow 20 soon.. leaving my teen years which were at times difficult..at times struggling…at times filled with creativity…at times filled with laziness..at times […]

Today in this C++ tutorial, we will be learning about the array of objects and dynamic memory allocation for objects and array of objects. Though, […]

Constant Member Function Constant member function is a function of a class which has been made constant by adding a keyword “const” at the end […]

Static data members of a class The data members of a class can be made static by adding keyword static infront of data members. It […]

we use a theorem to verify this statement. theorem X-:every context free language is decidable=above superset conditions etc let us consider that A is a […]

Copyright © 2019 | WordPress Theme by MH Themes