subject
Computers and Technology, 01.09.2019 14:30 anyar

Ihave to writea piece of code to calculate the factorial of somewhat large numbers so the long long type won't suffize, so using vector, i stumbled upon some issues during run time:
'#include
#include
using namespace std;
vector factorial(short n)
{
vector v, z;
do
{
short m = n%10;
v. push_back(m);
}while(n/=10);
short temp = 0;
int x;
//short m = 0;
while(n-1)
{
for(auto & w : v)
{
x = w*(n-1) + temp;
temp = x/10;
z. push_back(x%10);
}
}
return z;
}
int main()
{
short t;
cin > > t;
vector v;
short temp;
while(
{
cin > > temp;
v. push_back(temp);
}
vector tmp;
for(auto & w : v)
{
tmp = factorial(w);
for(auto i=tmp. end(); i! =tmp. begin();
cout < < *i;
cout < < endl;
}
return 0;
}
'

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:00
Lisa has a section of her document that she would like to include in the index. which option should lisa choose? mark index mark entry insert endnote add text
Answers: 3
question
Computers and Technology, 23.06.2019 06:00
When is a chart legend used a. all the time b. whenever you are comparing data that is the same c. whenever you are comparing multiple sets of data d. only for hand-drawn charts
Answers: 2
question
Computers and Technology, 23.06.2019 11:30
In cell h5 enter a formula that will calculate the percentage of attendees that went to the altamonte springs job fair in 2018.
Answers: 1
question
Computers and Technology, 24.06.2019 01:30
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
You know the right answer?
Ihave to writea piece of code to calculate the factorial of somewhat large numbers so the long long...
Questions
Questions on the website: 13722361