在一个编译器中运行但崩溃另一个 [英] Runs in one compiler but crashes another
本文介绍了在一个编译器中运行但崩溃另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么这段代码在inc ++ shell中运行(你必须将第4行更改为main(int)才能运行)但是在通过dev c ++运行时会崩溃?
Why does this code work inc++shell(you have to change line 4 to "main(int)" for it to run) but crashes when ran through dev c++?
#include<iostream>
using namespace std;
main()
{
int primes,count=0,remNum=2,current=2;
cout<<"how many primes can i find for you?";
cin>>primes;
while(count<primes)
{
if(current=remNum)
{
cout<<current<<endl;
current++;
remnum=2;
count++;
if(current%remnum=0)
{
}
remnum++;
return 0;
}
我的尝试:
复制并粘贴它并在dev c ++中重新编译,其他程序运行。之前如果有一个永无止境的循环,它就会闪烁,直到你关闭才会完成。这个说exe已停止工作
What I have tried:
copy and pasting it and recompiling it in dev c++, other programs run. and before if there was a never ending loop it would just flash and never finish until you closed. this one says the exe has stopped working
推荐答案
可能cut'n'paste很不幸,因为
Probably the cut'n'paste was unfortunate, for
if(current=remNum)
这是一个错误(你应该使用 ==
operator)。
it is a mistake (you should have used the ==
operator).
这篇关于在一个编译器中运行但崩溃另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文