[英]no output displayed on cmd
I'm new to g++ compilers on windows.我是Windows上g ++编译器的新手。 I installed a g++ compiler(MinGW).
我安装了一个g ++编译器(MinGW)。 I imported a c++ file on python using MinGW in cmd in administrator mode.
我在管理员模式下使用cmd中的MinGW在python上导入了c ++文件。
Python code : Python代码:
import sys, os
def main(argv):
if '-i' in argv[0]:
run(argv[1])
def run(a):
os.system('g++ ' + a+'.cpp' + ' -o ' + a + '.exe')
os.system(a + '.exe')
if __name__ =='__main__':
main(sys.argv[1:])
The C++ code : C ++代码:
#include<iostream>
using namespace std;
int main()
{
int a,r,b=0;
cout<<"enter a number : ";
cin>>a;
int t=a;
while(a)
{
r=a%10;
b=b*10+r;
a/=10;
}
if(t==b)
cout<<"\n Palindrome";
else
cout<<"\n Not a palindrome";
}
where D:\\Program Files\\Python and D:\\Program Files\\MinGW\\bin are the folders containing Python and MinGW .exe files respectively.其中D:\\ Program Files \\ Python和D:\\ Program Files \\ MinGW \\ bin分别是包含Python和MinGW .exe文件的文件夹。
No output is displayed here.这里没有显示输出。 According to the code, The output should be :
根据代码,输出应为:
enter a number : 7676
Not a palindrome
or或者
enter a number : 767
Palindrome
When I execute the same code in Ubuntu terminal, I got the expected output whereas in cmd it's not.当我在Ubuntu终端中执行相同的代码时,我得到了预期的输出,而在cmd中却没有。 Kindly help me to get the desired output...
请帮助我获得所需的输出...
I'm new to g++ compilers on windows.我是Windows上g ++编译器的新手。 I installed a g++ compiler(MinGW).
我安装了一个g ++编译器(MinGW)。 I imported a c++ file on python using MinGW in cmd in administrator mode.
我在管理员模式下使用cmd中的MinGW在python上导入了c ++文件。
Python code : Python代码:
import sys, os
def main(argv):
if '-i' in argv[0]:
run(argv[1])
def run(a):
os.system('g++ ' + a+'.cpp' + ' -o ' + a + '.exe')
os.system(a + '.exe')
if __name__ =='__main__':
main(sys.argv[1:])
The C++ code : C ++代码:
#include<iostream>
using namespace std;
int main()
{
int a,r,b=0;
cout<<"enter a number : ";
cin>>a;
int t=a;
while(a)
{
r=a%10;
b=b*10+r;
a/=10;
}
if(t==b)
cout<<"\n Palindrome";
else
cout<<"\n Not a palindrome";
}
where D:\\Program Files\\Python and D:\\Program Files\\MinGW\\bin are the folders containing Python and MinGW .exe files respectively.其中D:\\ Program Files \\ Python和D:\\ Program Files \\ MinGW \\ bin分别是包含Python和MinGW .exe文件的文件夹。
No output is displayed here.这里没有显示输出。 According to the code, The output should be :
根据代码,输出应为:
enter a number : 7676
Not a palindrome
or或者
enter a number : 767
Palindrome
When I execute the same code in Ubuntu terminal, I got the expected output whereas in cmd it's not.当我在Ubuntu终端中执行相同的代码时,我得到了预期的输出,而在cmd中却没有。 Kindly help me to get the desired output...
请帮助我获得所需的输出...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.