49,761 Topics
| |
As in, if you had an if statement, for example: [CODE]if(endProgramChooseType != 'y' || 'Y' || 'N' || 'n'){ (code for exiting program) }[/CODE] How would you do that in a switch statement? without doing [code]case 'a': case 'A': case 'b': case 'B': case 'c': [/code] etc. | |
Hello altogether, I am supposed to work through a project written in C++ and QT for Windows platforms. Now I am not an expert in window-related stuff. I installed MinGW 3.4.5 and QTSDK on Win XP SP3. I am using the tool "qmake" to create a makefile with all dependecies … | |
Hello all amatuer user of C++ please help me recode this the question is this: The function String_To_MDY() assumes the user correctly enters the date in the form mm/dd/yyyy. Recode this function to include the following test. Test the string ensure the user enters two digits, followed by a slash, … | |
Hey all, I've been programming an ISBN system of sorts and I'm a little stuck (again). I want to output my linked list to a text file, so I setup the code like this: [code] void saveList(char fileName[40]) { for ( list< Publication* >::iterator it = pubList.begin(); it != pubList.end(); … | |
hey guys! im just so frustrated with this error .. more like a bug though heres a link to all my code on google docs [URL="https://docs.google.com/document/d/1JxrZtbBJ8RPpMvuXvi767Y4gBSiXmKauNu7RApHNVbg/edit?hl=en_GB"]Source[/URL] the bold and enlarged stuff is whats causing the bug problem is when i add [ICODE]void Platform::set_clips(SDL_Rect platClip[], int i)[/ICODE], i guess something in … | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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, … | |
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. … | |
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. … | |
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 … | |
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 … | |
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, … | |
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 = … | |
| |
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 … | |
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 … | |
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; … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
[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 … | |
[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, … | |
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 |
The End.