program has stopped working

May 23, 2013 at 3:31pm
so when i go to run the program i just get a error message saying the the program has stopped working correctly. now i know im new like brand new to this so any help is great lol

#include <iostream>
using namespace std;

int main ()
{

char letter ; letter = 'A' ; // declared then initialized.
int number ; number = 100 ; // declared then initialized.
float decimal = 7.5 ; // declared and initialized.
double pi = 3.14159 ; // declared and initialized.
bool isTrue = false ; // declared and initialized.

cout << "char letter: " << letter << endl ;
cout << "int number: " << number << endl ;
cout << "float decimal: " << decimal << endl ;
cout << "double pi: " << pi << endl ;
cout << "bool isTrue: " << isTrue << endl ;
return 0 ;
}
May 23, 2013 at 3:37pm
Works fine for me. :-S
May 23, 2013 at 3:37pm
Look fine to me technically with letter and number they are not initialed. You just assigned a value to the uninitialized value. Also if you output a boolean like that it will display a 1 or 0 at the top add the precompiled header #include <iomanip> the before your boolean put boolalpha <<
May 23, 2013 at 4:37pm
so if everything looks good then how come im getting the error message for the program not working properly when i run it

and side note so would the boolean look like

boolalpha << bool isTrue = false ;

bc im confused on that part
May 23, 2013 at 4:51pm
What exactly are the errors? I do not see any and I meant like this
1
2
3
4
5
6
7
8
#include <iostream>
#include <iomanip>

int main()
{
    bool isTrue = false;
    std::cout << "Bool isTrue: " << std::boolalpha << isTrue << std::endl;
}

I used std:: instead of using namespace std; since I'm not using all the other things in that namespace.
May 23, 2013 at 6:01pm
the error come when it starts the programs starts it gets the first line through and i can see it then it is basically a not responding kinda thing is there a way i can attach a screen shot so i can show you. i run the .exe and then got a

windows error

a problem cause the program to stop working correctly
windows will close the program and notify you if a solution is available

is it just my computer some thing i need to change. if so what lol
May 23, 2013 at 6:03pm
Try running it using the compiler instead you might be missing a .dll also you can put the image on a site that allows you to upload images then put the link here.
May 23, 2013 at 6:40pm
how do i run it using the compiler =/ and the book never said anything about making a .dll
May 23, 2013 at 6:53pm
Build it then run it. And certain IDE's don't compile it with the .dll like qt.. But if you are using visual studios or code::blocks you shouldn't need that. Anycase most people run the program via the IDE and not the .exe file.
May 23, 2013 at 7:04pm
ya im not using visual studios im using mingw gnu gcc.. so how do i run it with the IDE.. i sound so dumb ha feel like a idiot
May 23, 2013 at 7:46pm
Code::Blocks?
Dev-C++?
Orwell Dev-C++?
May 23, 2013 at 8:07pm
nope none of them im literally just starting out and teaching myself so any help is great
May 23, 2013 at 8:11pm
Where are you writing the code? Notepad?
May 23, 2013 at 8:16pm
As you're just beginning, I'd suggest you to use an IDE like Code::Blocks ( http://www.codeblocks.org/downloads/26 , take the MinGW 96mb setup) or Orwell Dev-C++ ( https://sourceforge.net/projects/orwelldevcpp/ )
May 23, 2013 at 10:34pm
haha umm no but yes lol im using notepad++
and i certainly will go and download those. you guys have been a big help
Topic archived. No new replies allowed.