49,756 Topics
![]() | |
Hello all, I will be placing my source code onto pastebin and making it private as I am scared of my fellow students stealing my hard work for this class. So far I have about 1000 lines of code that is pretty easy to understand and it compiles and runs … | |
This is a part the extension module im writing for python using c++. ( The complete source is available as an attachment ) [CODE] #include <python2.6/Python.h> #include <iostream> #include <fstream> #include "structmember.h" using namespace std; typedef struct { PyObject_HEAD fstream file; } CppFileObject; static int CppFile_init( CppFileObject *self, PyObject *args … | |
Hi! I am looking for something to compact the clear and push_back in one line... [CODE] std::vector<int> v(3,100); v.clear(); v.push_back(4); [/CODE] I have thought that vector::swap may be usefull for this task but still figuring out how. Any sugestion or idea? Thank you in advance! | |
Hello World !!! I am having problem in my project regarding mouse click within a particulr area on GL surface screen...when I click on that particular area..mouse click generates windows coordinate like (200,349). It's hard to sense the mouse click in that area on GL surface screen....so how can I … | |
Okay this feels like a really silly question. Values that I have set to private should be able to be used through out that class alone, yeah. Say I have this: [code] #include <iostream> using namespace std; class Telegram{ public: Telegram(); ~Telegram(); void getData(); private: int **telegram; int rows, cols; … | |
While compiling a simple code in c++ i get the errors C:\Users\ila\Desktop\mule\mule.c|1|iostream: No such file or directory| C:\Users\ila\Desktop\mule\mule.c||In function `main':| C:\Users\ila\Desktop\mule\mule.c|6|error: `cout' undeclared (first use in this function)| C:\Users\ila\Desktop\mule\mule.c|6|error: (Each undeclared identifier is reported only once| C:\Users\ila\Desktop\mule\mule.c|6|error: for each function it appears in.)| ||=== Build finished: 4 errors, 0 warnings … | |
[code]ofstream f; char c; f.close(); f.open(s.c_str(),ios::out); if(f.is_open()) { cout<<"Press <q> to save file"; char *text; int count=0,count1; while(1) { system("stty raw -echo"); cin>>c; cout<<c; system("stty cooked echo"); text[count]=c; ++count; if(c=='q') { text[count]='\0'; while (text[count1]!='\0') f.put(text[count1++]); f.close(); break; } } [/code] please help me out in this syntax i was not … | |
I need to implement graphics in c++.what IDE should I use and what are the library files required for it? Note-I have just a week time so please tell some suitable way by which I can learn. Regards | |
I've been working for a while now on a module assesment which is due in tomorrow. The trouble I have is that I have an extension, the module has finished and there is no one in my school to ask since it's been the Easter holiday :( Instead of 'borrowing' … | |
while debugging my code in code blocks I always get this error "<filename> - Debug" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! what should I do? | |
Hi there, I am new in C++/CLR. I am trying to access to Form1 property from a header file, but I can't. I have included this header file in Form1.h. Here is the source of the header file: // General.h #ifndef GENERAL_H #define GENERAL_H #include "Form1.h" void ChangeFormText() { Form1^ … | |
Title says it all, basically I'm just trying to print the pointer *p to display all the values in that array. [CODE]#include <iostream> #include <string> //#include <stdlib> using namespace std; void extend(double *p, double *q, double *a, int c); int main() { const int CONST = 10; double price[CONST] = … | |
![]() | I am currently a C# developer with about a year of experience. I am currently working on finishing my computer science degree with a minor in mathematics. I love the job that I am in, but I the things I really want to do are in C++ (i.e. game development, … |
I'm unable to use code blocks.I do not know how to compile and run code in this IDE.Please help. | |
I've spent the last hour trying to figure out why my calculations are not adding up. Once i run the program it just output 0 for the total points program averages and etc and it also leaves student name blank. Can someone please help me figure out the issue. thanks … | |
hey guys, im fairly new to this so feel free to tell me if i need to supply more info. basically i need to write code to read in a text file and store different values in different variables, so for example i would read in: bob 1.1 maths 1.2 … | |
[code] 1: int main() 2: { 3: unsigned short x; 4: unsigned short y 5: ULONG z; 6: z = x * y; 6: return 0; 7: } [/code] Please ... i got to many error. When I want z value to write in Textbox form window. Just like var … | |
Is there any LED control to add to MFC project in order to have some graphic sense of e.g a timer? | |
[CODE]#include<stdio.h> #include<stdlib.h> #include<string.h> void main() { char* a[10]={"asd","QWE","ghj"}; printf("%s %c",a[2],a[2][2]); // prints properly... "ghj j" puts(a[1]); //prints properly..."QWE" a[1][1]='t'; //gives segmentation fault.... }[/CODE] what is the mistake in the code...??/..pls help..have an exam in 6 hrs...thank you.... | |
Hey if I have a value that was p=3 in a for loop, and after a few loops it gets changed to p=6 is there anyway to say "go back to previous value"? | |
I´m trying to develop an avl tree in C++, but I have problems with my rotation algorithm. I have try ALL the algorithms I could find on the web, but none of they works and I can´t see where is the problem. Here is my structure: [CODE] typedef struct node{ … | |
So I have a "base" class called "SortData". When I try to allow my other header file "InsertionSort.h" inherit this base class, I keep getting a class type redefinition error. What am I doing wrong? Here's the base class header: [CODE] // SortData.h #include <iostream> using namespace std; class SortData … | |
Create a program that is a Point of Sales (POS) system for a restaurant. Your POS system should allow unlimited orders from any number of guest. Each guest should be able to order a drink, an appetizer, an entree, and a dessert. The program should present a total. In addition, … | |
hello, I'm almost done it, but I'm lost in the huge forest of c++... so, here's my code: [CODE]#include <iostream> #include <fstream> #include <time.h> #include <stdio.h> using namespace std; int gettime() { time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); } int … | |
I have a nested class declared as: [CODE]class A { class B { // members }; // members }; [/CODE] Is there a good way to avoid typing A::B every time I need to access B's members? I'd just like to do this in one .cpp file. I tried "using … | |
[B]In main.cpp[/B] [CODE]#include <iostream> #include "init.h" using namespace std; Initialization Init; int main() { Init.test(); return 0; } [/CODE] [B]In init.cpp[/B] [CODE]#include <iostream> using namespace std; class Initialization { public: void test() { for(int i=0; i<10; i++) { cout<<i; } } };[/CODE] [B]In init.h[/B] [CODE]#ifndef INIT_H_ #define INIT_H_ class Initialization … | |
Hi, I've confusion with static member variable in c++ class. Please have a look on following code. class test { public: static int i; float j; }; int test::i = 0; int main() { test *t = new test; test::i = 100; cout << "test::i = " << test::i << … | |
Hi Guys. I tried creating an insert into tree datastructure which is causing core dump. Please identify the issue... Here is the code [code] #include<iostream> #include<string> #include<stdlib.h> using namespace std; //Global Data struct Tree { Tree* right; Tree* left; int element; }; typedef struct Tree* TreeData; //Function Declaration void insert(TreeData … | |
I noticed that the main.cpp in a Qt application has to contain the following line: QApplication app(argc, argv). I know that argc is the number of command-line arguments, and argv is that array list of command-line arguments. But, the question in my mind is: what are those arguments I'm passing … | |
While running all codes in visual c++ it gives me the same error -"Error 1 fatal error C1083: Cannot open include file: 'test.h': No such file or directory c:\users\ila\documents\visual studio 2008\projects\game\game\testgame.cpp 1 " I have created the header file test.h. |
The End.