# set precision?

• 03-27-2003
Geo-Fry
set precision?
hey all, i am making a program to test if a number is prime (as some of you already know) and i got it working, except there is only one thing, and that is it doesnt work with numbers over 9 digets long, i tried putting
Code:

`cin >>n >>setprecision (20);`
which i saw someone do for a cout once, but it didnt work. is there any way to make it support more digets? here is my code:
Code:

```#include <iostream> #include <cmath> #include <string> int main() {   int i = 2;                            //the first number it tests   int n;   int b;   while(1)   {     cout <<"Enter a number to test.\n";     cin >>n;     b = (n % i);                        //be is the remainder of their number and 2     if(n == 2 || n == 3)     {       cout <<n <<" is prime.\n\n";       system("Pause");       return 0;     }     if(b == 0)                          //if there is no remainder...     {       cout <<n <<" is not prime. It is divisible by 2.\n\n"; //...its not prime     }     else     {       for(i = 3; i < sqrt(n); i = i + 2) //if its odd, it starts with 3, and goes up by 2 each time       {         b = (n % i);                    //same as before, except instead of 2 its the next odd value         if(b == 0)                      //if no remainder...         {           cout <<n <<" is not prime. It is divisible by "<< i <<".\n\n";  //...then its not prime           system("Pause");           return 0;         }  //end if         else                            //if its not yet known, it just repeats the loop         {         }  //end else       }    //end for         cout <<n <<" is prime.\n\n";        //once i > .5n (at which point its redundent) it declares it prime     }    //end else   }        //end while }          //end main```
a minor side note, if the number is divisible by 3, it says its divisible by 2, not a big deal but i couldnt find how to fix that.
also how do you use goto? or something like that, because after it finds a number not prime it has to quit, i would rather use something like goto then have to implament a loop.
`std::cout << std::setprecision(10) << s << std::endl;`