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
At steady state, air at 200 kPa, 325 K, and mass flow rate
Vera_Pavlovna [14]
Letra A

A letra

A.
Thank
3 0
3 years ago
How might constraints and trade-offs affect the final design of a bridge?
Rainbow [258]

Answer:

It will limit the materials for your bridge which could cause damage to your bridge

Explanation:

4 0
3 years ago
Read 2 more answers
Technician A says that crush zones on a vehicle are designed to collapse in a controlled manner. Technician B says that reinforc
Ierofanga [76]

Answer:

only A

Explanation:

3 0
3 years ago
What are the standard procedures involved in the fixing/securing of cables?​
Sladkaya [172]

<u>Cable should be pre-cut and hung suspended for 48 hours to develop its most natural set and lay prior to installation.</u>

<u>Cable should be installed with, not against, its natural set. ... </u>

<u>Strain relief on either end will reduce conductor breakage at the flex points.</u>

4 0
2 years ago
A metal having a cubic structure has a density of , an atomic weight of , and a lattice parameter of Å One atom is associated wi
Veronika [31]

Answer:

Explanation:

Answer: The crystal structure of the metal is BCC

Explanation:

we first calculate the volume of the unit cell.

Volume of unit cell= (a°)^3.

The lattice parameter here is a°.

Substitute (6.13 * 10^-8)cm for a°.

Volume of unit cell = (6.13 * 10^-8)^3 = 2.3034 * 10^-22 cm^3/cell.

To determine the crystal structure we use

Density (p) = {(Number of atoms per cell) (Atomic mass)} / {(volume of unit cell)(Avogrado constant)}.

Substitute 1.892g/cm^3 for p (6.02*10^23) atoms/mol for Avogrado constant 1.3921g/mol.

For atomic mass and (2.3034 * 10^-22) cm^3/cell for unit cell.

1.892g/cm^3 = {(Number of atoms per cell) (1.3291g/mol)} / {(2.3034 * 10^-22) (6.02 * 10^23 atoms/mol)}.

Changing the subject of formula we have :

Number of atoms per cell = {(2.3034 * 10^-22) * (6.02 * 10^23) * 1.892} / 132.91

Number of atoms per cell = 2.

Since the number of atoms per cell is 2, :. the crystal structure of metal is BCC.

Note: p = density

a° = a subscript o

4 0
3 years ago
Other questions:
  • A cylindrical metal specimen having an original diameter of 11.53 mm and gauge length of 51.4 mm is pulled in tension until frac
    11·1 answer
  • Consider the general form of the Reynolds transport theorem (RTT) given by dBsys dt = d dt ∫CV rhob dV + ∫CS rhobV› r·n › dA whe
    11·1 answer
  • A single-threaded power screw is 35 mm in diameter with a pitch of 5 mm. A vertical load on the screw reaches a maximum of 5 kN.
    13·1 answer
  • Calculate the reflection loss that is incident normal to the surface of a triple pane window (assume n for window glass is 1.5)
    7·1 answer
  • Wave flow of an incompressible fluid into a solid surface follows a sinusoidal pattern. Flow is two-dimensional with the x-axis
    13·1 answer
  • The passage says that the president's guests "believed the rest at the 'Little
    13·1 answer
  • A work element in a manual assembly task consists of the following MTM-1 elements: (1) R16C, (2) G4A, (3) M10B5, (4) RL1, (5) R1
    9·1 answer
  • How many spark plugs does a diesel have? How many glow plugs? If you are a redneck/country person dont answer...I wanna see how
    10·2 answers
  • The compression ratio of most small gasoline engines falls between_______and________.
    13·2 answers
  • Technician A says that one function of oil is to clean. Technician B says that one function of oil is to cushion. Who is correct
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!