dev-c++

integer constant is too large for “long” type [duplicate]

大憨熊 提交于 2019-11-30 00:46:29
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: long long in C/C++ Writing a simple program for a project Euler problem. Refuses to compile because "integer constant is too large for "long" type" , even though it should be well within the size limits of an unsigned long long . Using the dev-c++ compiler. code in question: #include <iostream> bool isprime (unsigned long long i) { if(i==1||i==0) return false; if(i==2) return true; for(unsigned long long k=2;k!

Opencv2.4.0 with mingw in windows get crashed

ⅰ亾dé卋堺 提交于 2019-11-29 16:24:36
I followed steps in this SO link to compile a sample program using OpenCV2.4.0 in windows. I made a setup both in DEVC++ and NetBeans with Mingw. My sample Program is getting Compiled properly, but when I run the exe the application get crashes. But In same machine I used opencv2.1.0 and the same sample program gets compiled and there is no crash while running it. The below is the Sample Code I tried to execute: #include "highgui.h" using namespace std; int main( int argc, char** argv ) { IplImage* img = cvLoadImage( "C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample

IP camera and OPENCV

六月ゝ 毕业季﹏ 提交于 2019-11-29 12:45:19
Good day! I am using Dev-C++ as my IDE and the library OpenCV. I need to fetch the video taken by my IP camera and process it using the OpenCV. Can someone teach me how will I gonna do it. My OS is windows 7 64 bit. Thank you very much.. if it's a recent opencv version, this might work: Mat frame; namedWindow("video", 1); VideoCapture cap("http://150.214.93.55/mjpg/video.mjpg"); while ( cap.isOpened() ) { cap >> frame; if(frame.empty()) break; imshow("video", frame); if(waitKey(30) >= 0) break; } one way or the other, opencv seems to insist, that the url must end with ".mjpg" (dot mjpg), so if

Microsoft Visual C++, compiling small source codes without project file

為{幸葍}努か 提交于 2019-11-29 07:14:51
Well, I've been using Dev-C++ for a while for learning the language [c++], and some stuff wouldn't work properly, like global and local variables. Then I decided to download Microsoft Visual C++ to see how it compared, and it was absolutely great; especially with its aesthetics. One thing that has bothered me, though, is that since I need to make lots of small source files to test out things I've learned, I have to make a large project file each and every time, which take up ~18mb of space. I have tried to just make a source C++ file, but it never works since the compile and run buttons don't

Program crashes when trying to read numbers with scanf

倖福魔咒の 提交于 2019-11-28 14:37:32
A message like this appears, when i run this code. Project.exe has stopped working Some of my other code works, but this seems to throw me an error. #include<stdio.h> #include<conio.h> void main() { int n1, n2, sum; puts("first number"); scanf("%d", n1); fflush(stdin); puts("second number"); scanf("%d", n2); sum = n1 + n2; printf("%d + %d = %d", n1, n2, sum); getch(); } I basically want to add two numbers. scanf takes the address of the variable in which it stores the input value. You need to change your scanf calls to scanf("%d", &n1); scanf("%d", &n2); // ^ note the & operator Also, note

Opencv2.4.0 with mingw in windows get crashed

折月煮酒 提交于 2019-11-28 10:30:29
问题 I followed steps in this SO link to compile a sample program using OpenCV2.4.0 in windows. I made a setup both in DEVC++ and NetBeans with Mingw. My sample Program is getting Compiled properly, but when I run the exe the application get crashes. But In same machine I used opencv2.1.0 and the same sample program gets compiled and there is no crash while running it. The below is the Sample Code I tried to execute: #include "highgui.h" using namespace std; int main( int argc, char** argv ) {

Get current username in C++ on Windows

流过昼夜 提交于 2019-11-28 09:07:04
I am attempting to create a program that retrieves the current user's username on Windows using C++. I tried this: char *userName = getenv("LOGNAME"); stringstream ss; string userNameString; ss << userName; ss >> userNameString; cout << "Username: " << userNameString << endl; Nothing is outputted except "Username:". What is the simplest, best way to get the current username? Use the Win32API GetUserName function. Example: #include <windows.h> #include <Lmcons.h> char username[UNLEN+1]; DWORD username_len = UNLEN+1; GetUserName(username, &username_len); Corrected code that worked for me: TCHAR

Microsoft Visual C++, compiling small source codes without project file

夙愿已清 提交于 2019-11-28 00:30:01
问题 Well, I've been using Dev-C++ for a while for learning the language [c++], and some stuff wouldn't work properly, like global and local variables. Then I decided to download Microsoft Visual C++ to see how it compared, and it was absolutely great; especially with its aesthetics. One thing that has bothered me, though, is that since I need to make lots of small source files to test out things I've learned, I have to make a large project file each and every time, which take up ~18mb of space. I

Scanf is not scanning %c character but skips the statement, why is that? [duplicate]

霸气de小男生 提交于 2019-11-27 09:10:38
This question already has an answer here: scanf() leaves the new line char in the buffer 4 answers I wrote a program using switch case statement and asked for a char for input but it does not ask for the char in the console window but skips it completely int main() { float a, b, ans; char opr; printf("\nGIVE THE VALUES OF THE TWO NUMBERS\n"); scanf(" %f %f",&a,&b); printf("\nGIVE THE REQUIRED OPERATOR\n"); //no display(echo) on the screen //opr = getch(); //displays on the screen //opr = getche(); scanf("%c",&opr); switch(opr) { case '+' : ans = a+b; printf("%f", ans); break; case '-' : ans =

Program crashes when trying to read numbers with scanf

五迷三道 提交于 2019-11-27 08:52:45
问题 A message like this appears, when i run this code. Project.exe has stopped working Some of my other code works, but this seems to throw me an error. #include<stdio.h> #include<conio.h> void main() { int n1, n2, sum; puts("first number"); scanf("%d", n1); fflush(stdin); puts("second number"); scanf("%d", n2); sum = n1 + n2; printf("%d + %d = %d", n1, n2, sum); getch(); } I basically want to add two numbers. 回答1: scanf takes the address of the variable in which it stores the input value. You