So anyway, I have a problem. I'm practicing a little. I want to find the first prime number after a given number, but this program gives results that only make me confuse.
I even included windows.h and math.h just for being curious if it works with them but it doesn't.
Here's the code : [quote]#include <iostream>
#include <math.h>
#include <windows.h>
using namespace std;
int main(){
int numar;
int count;
int a;
bool yo=true;
cout<<"Introdu numarul de la care programul va incepe sa caute cel mai apropiat numar prim(atentie cu numerele foarte mari!)"<<endl;
cin>>numar;
numar=numar+1;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
while(yo){
a=2;
count=0;
while(a<numar-1){
if(numar%a==0){
count=count+1;
}
a++;
}
if(count>0){
yo=false;
}
numar=numar+1;
}cout<<"Primul numar PRIM aflat dupa numarul introdus este "<<numar<<endl;
system("pause");
system("CLS");
return main();
}
[/quote]
I need some serious help :).