1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andreyy89
3 years ago
9

Write a function that multiplies two decimal string representations of non-negative integers. The function takes two parameters

cx and cy, which are string decimal representations of integers, for example, cx = "1237091" cy = "23015" and returns their product as a string decimal representation: "28471649365". This is the function’s signature: Bool Multiply Integers(char* cx, char* cy, char* res);
Engineering
1 answer:
Illusion [34]3 years ago
7 0

Answer:

See explaination

Explanation:

#include<bits/stdc++.h>

using namespace std;

string multiply(char* num1,char* num2)

{

int l1 = strlen(num1);

int l2 = strlen(num2);

if(l1 ==0 || l2 == 0)return "0";

vector<int> result(l1+l2,0);

int in1=0,in2=0;

for(int i=l1-1;i>=0;i--)

{

int carry = 0;

int n1 = num1[i]-'0';

in2 = 0;

for(int j = l2-1;j>=0;j--)

{

int n2 = num2[j]-'0';

int sum = n1*n2 + result[in1+in2] + carry;

carry = sum /10;

result[in1+in2] = sum%10;

in2++;

}

if(carry>0)

{

result[in1+in2]+=carry;

}

in1++;

}

int i = result.size()-1;

while(i>=0&&result[i]==0)

{

i--;

}

if(i == -1)return "0";

string s = "";

while(i>=0){

string ch = "0";

ch[0] = '0'+result[i--];

s += ch;

}

return s;

}

int MultipyCIntegers(char* cx,char* cy,char* res)

{

string result = multiply(cx,cy);

if(strlen(res)!=result.length())return 0;

for(int i=0;i<result.length();i++)

{

if(res[i]!=result[i])

{

return 0;

}

}

return 1;

}

int main()

{

char* s1 = "1235421415454545454545454544";

char* s2 = "1714546546546545454544548544544545";

char* ans = "2118187521397235888154583183918321221520083884298838480662480";

cout<<MultipyCIntegers(s1,s2,ans);

}

You might be interested in
Why is the face of the claw on a claw hammer usually a smooth curve? Why isn't it straight or some other shape?
GarryVolchara [31]

Answer:

The face of the claw on the claw hammer is usually a smooth curve so as to improve the ease with which nails are removed when removing nails because as the nail held between the V shaped split claw is being pulled out from the wood, it slides more and more towards cheek, reducing the distance of the nail from the cheek which is the fulcrum, thereby increasing the mechanical advantage because the location of the hand on the grip remains unchanged

Explanation:

7 0
3 years ago
When was Lamborghini's Made<br> A.) 2004<br> B.) 1963<br> C.) 1923<br> D.) 1990
Serjik [45]

Answer:

1963

Explanation:

Sant'Agata Bolognese is a small comune in the Metropolitan City of Bologna, Emilia-Romagna, in the north of Italy. It is notable for being the headquarters of the luxury automobile manufacturer Automobili Lamborghini. It is named after Saint Agatha of Sicily.

7 0
3 years ago
The constant A in Equation 17.2 is 12π4 R/5(θD) 3 where R is the gas constant and θD is the Debye temperature (K). Estimate θD f
kirill115 [55]

Answer:

The Debye temperature for aluminum is 375.2361 K

Explanation:

Molecular weight of aluminum=26.98 g/mol

T=15 K

The mathematical equation for the specific heat and the absolute temperature is:

C_{v} =AT^{3}

Substituting in the expression of the question:

C_{v} =(\frac{12\pi ^{4}R }{5\theta _{D}^{3}  } )T^{3}

\theta _{D} =(\frac{12\pi ^{4}RT^{3}  }{5C_{v}   } ) ^{1/3}

Here

C_{v} =4.6\frac{J}{kg-K} *\frac{1kg}{1000g} *\frac{26.98g}{1mol} =0.1241J/mol-K

Replacing:

\theta _{D}  =(\frac{12\pi ^{4}*8.31*15^{3}  }{5*0.1241} )^{1/3} =375.2361K

3 0
3 years ago
Most ceilings are covered with plaster or…
Monica [59]

Explanation:

Most ceilings are coverd with plaster or board.

8 0
4 years ago
Read 2 more answers
Part D
Tatiana [17]

Answer:

clothes iron its 3rdyeyeyey

Explanation:

clothes iron its 3rd

clothes iron its 3rd

clothes iron its 3rd

clothes iron its 3rd

clothes iron its 3rd

btw quaotra

yesss

8 0
3 years ago
Read 2 more answers
Other questions:
  • Question 2/5
    14·1 answer
  • In Visual Basic/Visual Studio, characteristics of controls, such as the Name of the control, or the Text displayed on the contro
    10·1 answer
  • Which of the following vehicles has no emissions?
    9·1 answer
  • Which term defines the amount of mechanical work an engine can do per unit of heat energy it uses?
    6·1 answer
  • What is not required for current to flow through a conductor
    12·1 answer
  • A minor road intersects a major 4-lane divided road with a design speed of 50 mph and a median width of 12 ft. The intersection
    13·1 answer
  • Please help! timed test. This about electrical control. Please be serious.
    15·1 answer
  • What else will change, if you change the point of view
    10·1 answer
  • 9. Imagine that you're performing measurements on a circuit with a multimeter. You measure a total circuit
    14·2 answers
  • Chemical engineers determine how to transport chemicals.<br> O True<br> False
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!