Dev C ++ no output - c++

I am trying to write a simple project on Dev C++ , but it seems it is not working like it should on windows 8.
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
cout<<"hello You~~"<< endl;
system("PAUSE");
return 0;
}
After compiling it, it shows an empty black screen. Am I doing something wrong?

There are known issues with running Dev-C++ 4.9.9.2 on Windows 8 (it's not that surprising, it's a program from 2005). Try a newer IDE - if you like Dev-C++, you can try Orwell Dev-C++.

Related

C++ on VS Code . Output is not coming on the integrated terminal

I wrote a simple C++ program in VSCode. It is compiling without any issues, but the output is not visible on the VSCode integrated terminal. If I open a separate terminal externally using cmd, I can get the output. Can someone explain this behavior?
#include <iostream>
using namespace std;
int main() {
cout << "Weclcome";
return 0;
}

Program output obtained(no error) but program.exe not working while using graphics.h

I already have graphics.h(and relevant files in MinGW ) but the programs are not working, because after build and run, I get required text output on output window but not the corresponding graphics
because program_name.exe stops working.
I already have searched all over the internet, StackOverflow is my final hope.
I have been doing competitive programming in c+ +, just tried to get into graphics with c++ in code blocks.
#include <graphics.h>
#include <iostream>
using namespace std;
int main()
{ cout<<"a";
int gd= DETECT,gm ;
char driver[] = "";
initgraph(&gd, &gm, driver);
//initgraph(&gd,&gm," ");
circle (100,100,100) ;
getch();
closegraph();
return 0;
}
This is VERY retro. In order for this to even come CLOSE to working you will need to create an MSDOS virtual machine under something like VirtualBox, install DOS 6.2 or similar, install the Borland BGI, Borland C++ 5.02 and then you MIGHT get it to work. Failing that, you could just find an old IBM PC and install DOS on it along with everything else above. Have fun!

C++ run error with command sfc /scannow

I'm new here and I wanted to write a C++ source code that executes the command:
sfc.exe /scannow
But it doesn't work. Windows-resource protection can't start repair service.
I'm a student and I'm in my 10th grade and I do not have computer science at school, so I wanted to ask the question here.
Here is my code excerpt:
#include<stdlib.h>
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
system("sfc.exe /scannow");
}
The compiler brings no errors.
I am using the GNU/GCC compiler, Windows 10 1803 and Code::Blocks(IDE)
I hope you can understand it :)
If you are using 64 bit system but your compiler is 32 bit means you will get this error. If you are using visual studio c++ and your pc is 64 bit system means change the platform to 64 bit.
For more information, ref this answer https://stackoverflow.com/a/20872354/6599346
Your code works, if you delete the # before main() and using namespace and just for completion I added return 0; at the end.
Code:
#include<stdlib.h>
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
system("sfc.exe /scannow");
return 0;
}
Run the code with administrator rights and everything should be okay.

C++ "Hello world" shows no output

I installed Codeblocks on my Windows 10 computer. To check that everything works fine, I first compiled the simple C program
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello world!\n");
return 0;
}
That works without problem but when I try the C++ equivalent:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return(0);
}
Then the "command prompt" window opens but no output is shown. I can see in taskmanager that the program is running but as said without any visible output. I also tried running the program directly from the command line but with the same effect. Anyone any ideas?
I found the issue. There was still an older version of MinGW installed in a different folder. I deleted all instances of MinGW, and codeblocks as well. Adter I reinstalled codeblocks everything worked as it should.
This Guy solved similar problem with Codeblocks.
Remove the following Global compiler setting:
-Wl,-subsystem,windows

Why sizeof works well on linux and encounter a runtime error on windows

I wrote a simple program in c++:
#include<iostream>
using namespace std;
int main()
{
cout<<sizeof(bool)<<endl;
return 0;
}
but when I compiled it with minGW and run it on windows7,a messagebox comeout saying Application stop working.but when I compiled it on linux with g++,it works well.How could this happen?
when I use printf on windows it works fine.Could anyone please explain why?
Are you sure you have the latest C++ libraries? in the old one it is just check this out.
and i think the new library is std::cout<<"" so i think you are using the old library. Try <iostream.h>