Question

write c++ program to find the quotient and modulus of two large numbers represented as strings...

write c++ program to find the quotient and modulus of two large numbers represented as strings
string quotient(string number1, string divisor);

string mod(string number1, string divisor);

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
#include <string>
using namespace std;
string mod(string number1,string divisor)
{
long int num1=stoi(number1);
long int num2=stoi(divisor);
string number3=to_string(num1%num2);
return number3;
}
string quotient(string number1,string divisor)
{
long int num1=stoi(number1);
long int num2=stoi(divisor);
string number3=to_string(num1/num2);
return number3;
}
  
int main()
{
cout<<"the modulus of given numbers\t"<<mod("12","3")<<"\n";
cout<<"the quotient of given numbers\t"<<quotient("12","3")<<"\n";
  
return 0;
}

Here stoi() converts a string to a number

and to_string() converts a number to a string

Add a comment
Know the answer?
Add Answer to:
write c++ program to find the quotient and modulus of two large numbers represented as strings...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT