W2_Programming-Qs 1:
The following program is used to multiply two complex numbers. Fill in the blanks (in LINE-1,
LINE-2 and LINE-3) so that it will satisfy sample input and output.
PROGRAM:
Complex operator *(Complex &p1, Complex &p2) { // LINE-1
struct Complex p3 = { 0, 0 };
p3.x = p1.x*p2.x-p1.y*p2.y; // LINE-2
p3.y = p1.x*p2.y+p1.y*p2.x; // LINE-3
return p3;
}
W2_Programming-Qs 2:
Consider the following program and fill in the function header print() at LINE-1 such that
it matches the given test cases.
PROGRAM:
void print(string a )
{
string b="Anyone";
cout << a << " " << b;
}
void print(string a,string b )
{
Disclaimer: Here you can find all nptel assignment solutions related to CS stream.These may help you for your assignment.The answers are only for verification.You cannot copy these directly from the post(code of conduct of NPTEL).These is not 100% correct solutions.
No comments:
Post a Comment
If you have any problems related to solutions or any concept please let me know.