49,761 Topics
| |
Hello all Currently i am developing my first game using Allegro 4.2.3 in C++. but i have got few problems/confusions 1.i want to use different font from that available by default. I have read there wiki and articles but i could not figure out any simple way. Specifically i would … | |
1)What's the safest way to receive data from a php script and return to an exe? 2)If I have lets say char Hi[4] = "3E2C"; and I wanted to put this into a BYTE Bye[2]; how would I do this so that Bye[0] = 0x3E and Bye[1] = 0x2C? Thanks … | |
[CODE="CPP"] int BattleSituation::getHPData(int player, int slot) { PokeBattle &p = this->poke(player,slot); return p.lifePoints(); } int callGetDataHP(const BattleSituation&situation, int id, int pokeslot) { return situation.getHPData(id, pokeslot); } QScriptValue ScriptEngine::getBattleData(int id, int pokeslot) { if(!loggedIn(id) || pokeslot < 1 || pokeslot > 6) { return myengine.undefinedValue(); }else{ return callGetDataHP(getHPData, id, pokeslot); } … | |
About a year ago, I built a simple ray tracer in Java, and now I'm trying to port it to c++, but I can't figure out how to get a couple of my classes to work together. It should be fairly strait forward, but its not working. Here is a … | |
1. What is the purpose of using a DLL over a .lib or just a single .exe? 2. What exactly (in VC++) does __declspec(dllimport) and __declspec(dllexport) do and where would you use them? 3. What is the correct way of using and linking DLLs? 4. How do you export things … | |
Ok, The only reason I'm asking this is because I want to be absolutely clear on it. In C++, if I write [CODE]int* ipSomePointer;[/CODE] [B]Is this the same thing as:[/B] [CODE]int *ipSomePointer;[/CODE] [B]or[/B] [CODE]int& iSomeRef = ...;[/CODE] [CODE]int &iSomeRef = ...;[/CODE] It does give the same result as each other … | |
I have some code I found that takes screenshots and saves them as a bitmap image. I'm trying to get it to save the screenshots as .jpg and I don't know how to. I don't want to use a large third party library if I don't have to, I would … | |
hey...i have a code here[CODE]#include<iostream> #include<fstream> using namespace std; void Avgs(int Array[],int N,int& Ave,int& AveP,int& AveN){ AveP = 0; AveN =0; for(N=0,N<10,N++;;) Ave=Ave+ Array[N]; Ave=Ave/10; for(N=0,N<10,N++;;){ if (Array[N]>= 0) AveP= AveP+Array[N]; else AveN= AveN+Array[N]; } {AveP= AveP/6; AveN= AveN/4; } void Large(int Array[],int N, int& Big);{ int Big = 0; … | |
hello everyone my aim is to count different words from text file and write them to output file with the number of occurences.but my code didn't work,I don't know the mistake but I think my read and write functions cause the problem.any help or suggestions? [CODE] #include<iostream> #include<string> #include<fstream> #define … | |
Hi, Can i use realloc to deallocate the memory allocated using new operator. For example: int * i = new int (10); realloc (i, 0); Thanks in advance. | |
[CODE] #include <algorithm> #include <iostream> #include <Windows.h> #include <string> #include <cctype> using namespace std; int main(void) { //declare variables char npcname; char actid; //askin the user to input npc name cout << "Please Enter Your NPC Name!"<<endl; cin >> npcname; //askin the user to input action id cout << "Please … | |
how can i merge the values of the arrays? if i get the values of each array in a file.txt and file2.txt [CODE] void ReadList() { ifstream fin; fin.open ("1.txt"); for(A=0; A<10; A++) fin >> Array[A]; fin.close(); ifstream fin2; fin2.open("2.txt"); for(B=0; B<20; B++) fin2 >> Array[B]; fin2.close(); N=A+B; cout << … | |
[CODE]#include <algorithm> #include <iostream> #include <string> using namespace std; int main(void) { int actid; cin >> actid; if(actid != 1,2,3,4,5,6,7,8,9,0) { cout << "you must enter an integer"; return 0; } }[/CODE] but it's fail :( | |
can you please explain to me why htese errors happen and what is the solutions for this...pleeeaaassee..:)) Problem: Write a C++ program which will read in a list of numbers, find the average of all numbers, the average of thepositive and negative numbers, and the largest element. Your program should … | |
[CODE] #include<iostream> using namespace std; int main() { int* p=new int[2]; p[0]=1; p[1]=2; cout<<p[0]<<" "<<&p[0]<<endl; cout<<p[1]<<" "<<&p[1]<<endl; cout<<endl; cout<<*p<<" "<<p<<endl; p++; cout<<*p<<" "<<p<<endl; delete [] p; } [/CODE] the output of the above program is : 1 0xe502f0 2 0xe502f4 1 0xe502f0 2 0xe502f4 aborted(core dumped) can anyone pls tell … | |
[CODE] #include <iostream> #include <string> using namespace std; int main(void) { string test; test="this is a test" test.replace(' ','~')// replace the space with ~ cout << test; return 0; } [/CODE] but it's not working can anyone help me? | |
Ok, I am sort of new to C++, and I just came across something that I don't fully understand. [CODE]int main(){ int iX=5; { int iY=30; std::cout<<iY<<std::endl; } std::cout<<iX<<std::endl; return 0; }[/CODE] What does it mean when I make a code block with no if,else etc..? Does it just make … | |
I've been using Visual Studio 2010 Ultimate to learn C++ and have created a project file. Within that project file are 2 .cpp files. I use one to refresh my memory of what I've learned and the other to enhance my knowledge of C++. The problem is that whenever I … | |
hi all i want to read a secific line in a text file here is the text file form [CODE]iphuc 0.6.1 with tab completion. >> By The iPhoneDev Team: nightwatch geohot ixtli warren nall mjc operator Unsupported iTunesMobileDevice.dll Version ee0000 15 CFRunLoop: Waiting for iPhone.[/CODE] or [CODE]iphuc 0.6.1 with tab … | |
Is there someone who can help me with this? Write a C++ program which will read in a list of numbers, find the average of all numbers, the average of thepositive and negative numbers, and the largest element. Your program should contain at least four functions -- one to read … | |
could someone help me, i dont know how to show the results... [CODE]#include <iostream> #include <fstream> using namespace std; int ReadList(int Array[], int N) { int list=0; for(N=0; N<10; N++) { list= Array[N]; } return list; } void Avgs (int Array[], int N, int &Ave, int &AveP, int &AveN) { … | |
Hi, This is my first post in daniweb! I've two questions: First question: I'm currently studying about classes, and could get '=' overloading format: [CODE][COLOR="Red"]T&[/COLOR] T::operator =(const T& b);[/CODE] Why we set it to return reference? what's the use? Why couldn't simply be: [CODE][COLOR="red"]void[/COLOR] T::operator =(const T& b);[/CODE] I've used … | |
[CODE] #include<iostream> #include<fstream> using namespace std; int main() { char a='p'; int b=23; float c=45.67; ofstream out("test.txt"); out<<a<<" "<<&a<<endl; out<<b<<" "<<&b<<endl; out<<c<<" "<<&c<<endl; } [/CODE] the output for this is in the text file: p pα#a/ 23 0x22cd08 45.67 0x22cd04 why is the address of the character variable is very … | |
hi guys ! i had this code snippet from the net...so i m trying to understand the code but m not getting those points plz help me 1.what does return 2,return 4,return 6 means in this code? 2.why we have case '#' ,why '#' opreator is assigned to stack[top]; 3.if(isoperator(symbol)==0) … | |
hi guys I have a C++ code that works great, but when I want to modify, It gives an debug error. "invalid allocation size .... byte". what should I do? | |
I've tried to make an implementation of a std::vector, but it has some bugs that I cannot figure out, for one, the Append (same as push_back) method doesn't work. If anyone could help me to find the bugs that would be appreciated. [code=c++] template< typename t > class vector_t{ t … | |
I'm reading a book called Beginning Algorithms by Harris and Ross, which gives code examples in Java. As an academic exercise I am trying to convert the code examples to C++. In the interface below the part that throws me is the return of the 'Object' by the 'current' method. … | |
I am using this as an example to show what I want to do. I have already done a char array like this: char name[10][10] = {"1. One", "2. Two", "3. Three", "4. Four", etc.. down to 24. I have already wrote the code, so all these 24 subarrays can … |
The End.