49,757 Topics

Member Avatar for
Member Avatar for Oinkertop

I'm currently developing a game (And no, just because that's the case doesn't mean this belongs in game development), and I've run into a problem. Basically, I need to generate a random number. The number needs to stay the same after it is generated once. The code is in an …

Member Avatar for Oinkertop
0
145
Member Avatar for Anuradha Mandal

I want to print a pyramid like this..... ***** **** *** ** * This is my code.....[CODE]#include<iostream> #include<conio.h> using namespace std; int main() { int i,j; int b; char* sp=" "; cin>>j; for(int a=j;a>=1;a--) { for( b=a;b>=1;b--) cout<<"*"; cout<<endl; for(int k=1;k<b;k++) cout<<sp; } getch(); return 0; } [/CODE] But it …

Member Avatar for Anuradha Mandal
0
104
Member Avatar for Steven9999

Hello all I have a project written in C + + On the platform Windows XP I want to convert the text to voice How can I do that? ? Are there functions In audio/ sound libraries convert the text to voice??? I hope you help me

Member Avatar for Steven9999
0
118
Member Avatar for ChaseRLewis

I get this warning and I can't seem to figure out what it is referring too (it repeats this exact one ALOT when i have very little code). I'm trying to implement boost archive into my project as it allows less code to be written when serializing classes. [CODE] c:\program …

Member Avatar for vijayan121
0
223
Member Avatar for skorm909

So I've never worked with percentages in c++ and I was wondering how to incorporate into a program I'm making for a game so see what the chances are that an item will reach a certain level depending on the chance of success for each different level. Here's what I …

Member Avatar for raptr_dflo
0
143
Member Avatar for massivedynamic

I've recently started using PDCurses in a C++ game I'm working on. When I compile the program on my own machine (windows) and run the .exe, everything works as it should. When I take that .exe onto a different computer that doesn't have PDCurses and I try to run it, …

Member Avatar for raptr_dflo
0
861
Member Avatar for termin8tor

Hey all, I'm attempting to use an STL List to store a list of objects. Now I realise it's quite trivial to store a list of objects of my own definition. My real question is, how do I fill the list with objects that inherit from a base class. E.g. …

Member Avatar for termin8tor
0
267
Member Avatar for SecretDavidMAN

When I ask the user to enter in a number of games, Say I wish to do 5 fights. It runs the fight, then stops after 1 player wins. It doesn't loop back around, DO health levels need to be reset? I also think I did my coin flip wrong. …

Member Avatar for Raimucka
0
102
Member Avatar for Tauren

I am looking for a PKC library, I would like one that is decently fast. I have looked at RSA, but I cannot seem to find any decent libraries that would work. I will be encrypting packets that are sent out via UDP, however one client will have the private …

Member Avatar for nezachem
0
138
Member Avatar for evilguyme

hey guys i got one more question :O i have this code for a class function [CODE] void Platform::set_clips(SDL_Rect platClip[], int i) { for( int j = 0; j < i; j++ ) { platClip[j].x = 0; platClip[j].y = 0; platClip[j].w = random_number_w(); platClip[j].h = 5; } } [/CODE] is …

Member Avatar for evilguyme
0
88
Member Avatar for evilguyme

Hey guys! i just started using SDL engine to make a 2d game . This is the code ive got so far, you can view it online on googledocs via this link: [URL="https://docs.google.com/document/d/1S1upv5FxT3TvZsvhaZ1nFb39aUz-AVl7MhqP8zSZ4DM/edit?hl=en_GB"]CODE[/URL] i have made bold the code that causes the problem. when i do [ICODE]apply_surface(0, 0, stick, screen, …

Member Avatar for evilguyme
0
146
Member Avatar for Jennifer84

Hi, I have an URL like below. When typing that in explorer, that will let you download a .csv file. I simply wonder how you can do this in code instead. Reach the below URL and download this file to C:/ ? [code] string getURLfile = "http://ichart.finance.yahoo.com/table.csv?s=MSFT"; string savePath = …

Member Avatar for sergent
0
259
Member Avatar for bushh
Member Avatar for nuclear

So i just started learning SDL and came across "Event driven programming", just wanted to be sure if i understood the tutorial correcly. So lets say by adding: [CODE]SDL_Event event;[/CODE] i add lets say a container that keeps track of every event i do? After that i start using: [CODE]while …

Member Avatar for nuclear
0
282
Member Avatar for ameya1992

hello sir, actually what i want to do is to print a series of characters using outtextxy() function in c++ graphics. say my array contains '1','2','3','4','5'. using a for loop i want to print them at diff positions on screen. char c[]={'1','2','3','4','5'} int i,j=100 for(i=0;i<5;i++) { outtextxy(100,j,c); j+=100; } but …

Member Avatar for raptr_dflo
0
1K
Member Avatar for surajdevesan

hello guys, The file is not getting deleted in the function modify for some reason.....pls help!!!!!! pls do look at this code [CODE] #include <iostream.h> #include <conio.h> #include <fstream.h> #include <stdio.h> #include <iomanip.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <process.h> #include <math.h> #include <windows.h> class car { int no; …

Member Avatar for VernonDozier
0
5K
Member Avatar for harryhaaren

Hey all, (Skip down till "Question:" if you're in a rush) Context: I'm coding on an audio application which involves storing buffers of audio. I'm currently using a [ICODE]std::vector<float>[/ICODE], as a member of an [ICODE]AudioBuffer[/ICODE] class. These [ICODE]AudioBuffer[/ICODE] instances are held in another class [ICODE]ResourceHolder[/ICODE]. In the "process" callback (where …

Member Avatar for harryhaaren
0
628
Member Avatar for Satteshlikes

This is part of a cinema project code that my friend did. I understand most of the other parts, but when I came to this part, I am completely lost. Can someone please explain this to me line by line please. Thank You. If you need the complete code to …

Member Avatar for WaltP
-1
168
Member Avatar for ksm092

This is my code: [CODE] stringstream str_number string description while(!str_number.eof()) { str_number >> str_description; if (str_description.length() < 1) { break; } description = description +" "+ str_description; }[/CODE] My problem is that if the description is more than one string, the last string is repeated twice. For example if the …

Member Avatar for nuclear
0
1K
Member Avatar for ksm092

This is my code: [CODE] for (i = 0; i < date.size(); i++) { str_date << date[i]; str_date >> newDay; str_date >> newMonth; str_date >> newYear; apptDay.push_back(newDay); apptMonth.push_back(intMonth); apptYear.push_back(newYear); }[/CODE] My problem is that the first date[1] gets saved nicely, however the second round of the loop it all goes …

Member Avatar for ksm092
0
107
Member Avatar for TheProgramer

How can i sort the Last Names?? i used the Last Name to be the head so the properties or some info will follow...need help bum bump [CODE]#include <iostream> #include <string.h> #include <fstream> using namespace std; typedef struct Student { char Fname[50]; char Lname[50]; char age[50]; char ID[20]; struct Student …

Member Avatar for Narue
0
218
Member Avatar for vergil1983

I have been given a question to write a program to read a number x from the user and then print the value of ln(1+x). I have been given the following equation to perform the calculation: [CODE] 1 2 3 4 5 6 100 ln(1+x) = x x x x …

Member Avatar for raptr_dflo
0
211
Member Avatar for clyo cleopas

[CODE] //A c++ program that calculate and print parking charges #include <iostream> using namespace std; #include <iomanip> const double minimumFee = 7.00; const double hourlyFee = 1.75; const int numOfCustomers = 12; const int numOfMinsPerHour = 60; void inputAndValidate(int&,int&,int&,int&); void convertToMinutes(int&,int&,int&,int&); void convertBackToTime(int&,int&,int&); double calcCharge(int,int); int entranceMinutes,exitMinutes,entranceTimeInMins,exitTimeInMins ; int minutesParked,parkedMinutes,entranceHour,exitHour,parkedTime …

Member Avatar for raptr_dflo
0
1K
Member Avatar for murnesty

[CODE]union _Test { unsigned char keydata[4]; struct _Member { unsigned char a; unsigned char b; unsigned char c; unsigned char d; }Member; }Test; Test.keydata[4]= { 1, 2, 3, 4}; [/CODE] error on line 12: expected expression before '{' token. If I declare without union, [CODE]const unsigned char keydata[NUM_KEYS]={ 2, 1, …

Member Avatar for L7Sqr
0
2K
Member Avatar for logan_231_2009

hey guyz.. I don't understand the REAL job of a controller in MVC pattern. Can anyone show me a simple program with the controller's code? thanks a lot

Member Avatar for Stefano Mtangoo
0
790
Member Avatar for mike_2000_17

[B]Beginner's guide to C++0x: Avoiding Memory Problems by Design of Ownership[/B] If you ever read any resources on C++ programming or object-oriented programming, you must have heard some rethorics like "inheritance is for the [I]is a[/I] relation, composition is for the [I]has a[/I] relation". Is that all? Is that the …

Member Avatar for sergent
8
2K
Member Avatar for satish.paluvai

hi, if any body knows please send the information about L value required error in c++. if anybody knows please send it to <email snipped>[EMAIL="satish.paluvai@gmail.com"][/EMAIL] satish.paluvai:?:

Member Avatar for Narue
-1
268
Member Avatar for bettybarnes

What is the c++ code of this c language code [CODE]printf("%d", b[i])[/CODE] ??

Member Avatar for bettybarnes
0
98
Member Avatar for hailey.o3

this is the output of the program. Enter num1: 2 Enter num2: 2 Enter number of iteration: 2 1=1.5 final answer=2.5 we are assigned to do the program . it's really difficult .

Member Avatar for Fbody
0
131
Member Avatar for ksm092

I am trying to sort a vector of strings in order (one line consists of various strings e.g. 12 10 2010) and was wondering if I would be able to extract individual values from one line of a vector? The way I am doing this is by reading lines from …

Member Avatar for jinhao
0
180

The End.