49,761 Topics

Member Avatar for
Member Avatar for vinayakgarg

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 …

0
90
Member Avatar for jeffpro

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 …

Member Avatar for gerard4143
0
96
Member Avatar for AnonymousX

[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); } …

Member Avatar for arkoenig
0
241
Member Avatar for gth759k

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 …

Member Avatar for gerard4143
0
3K
Member Avatar for tomtetlaw

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 …

Member Avatar for tomtetlaw
0
91
Member Avatar for Badoodhi
Member Avatar for alexchen
-5
117
Member Avatar for Akill10

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 …

Member Avatar for Akill10
0
126
Member Avatar for pie555

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 …

Member Avatar for pie555
0
2K
Member Avatar for exekiel101

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; …

Member Avatar for WaltP
0
117
Member Avatar for kyros

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 …

Member Avatar for WaltP
0
220
Member Avatar for Sukhbir

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.

Member Avatar for abhityagi85
0
2K
Member Avatar for Mr_PoP

[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 …

Member Avatar for Saith
0
77
Member Avatar for jlianne18

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 << …

Member Avatar for Saith
0
201
Member Avatar for Mr_PoP

[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 :(

Member Avatar for Mr_PoP
0
144
Member Avatar for exekiel101

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 …

Member Avatar for Fbody
0
218
Member Avatar for indr

[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 …

Member Avatar for indr
0
161
Member Avatar for Mr_PoP

[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?

Member Avatar for Mr_PoP
0
164
Member Avatar for Akill10

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 …

Member Avatar for Akill10
0
134
Member Avatar for StickyTape

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 …

Member Avatar for myk45
0
200
Member Avatar for seifhatem

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 …

Member Avatar for Chronister
0
171
Member Avatar for jlianne

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 …

Member Avatar for jlianne18
0
156
Member Avatar for icasta13

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) { …

Member Avatar for icasta13
0
272
Member Avatar for Badoodhi
Member Avatar for Gh.S

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 …

Member Avatar for Gh.S
0
265
Member Avatar for indr

[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 …

Member Avatar for embooglement
0
149
Member Avatar for begineer

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) …

Member Avatar for begineer
0
114
Member Avatar for ako6626

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?

Member Avatar for vinayakgarg
-1
65
Member Avatar for tomtetlaw

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 …

Member Avatar for arkoenig
0
140
Member Avatar for gazzatav

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. …

Member Avatar for gazzatav
0
423
Member Avatar for staz

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 …

Member Avatar for Saith
0
234

The End.