49,758 Topics
| |
How do I make a variable a random value between 1 and 10 each time the program loops? I want to have a "I'm thinking of a number between 1 and 10..." thing, and then you have to guess the number, but I don't want the number to be the … | |
Hi all, Does anyone know if it is possible to write a C++ macro, which will force the compiler to construct Pascal/custom style string constants during compilation? The basic idea is to avoid unnecessary run-time construction from C-style to custom-style string literals. For example, when evaluating the expression {String2 = … | |
I'm trying to find a good, easy to use GUI for an inventory in my game, all I really want them to be able to do is select items, maybe move them around into different slots, and be able to modify variables based on where things are moved. I plan … | |
Hello friends, I am facing a linking problem in VC++8.0 compiler. Suppose I have a library, say A.dll. In this library I have a file, say x.cpp. Within this file there is a extern const variable, like [code] ..... __declspec( dllexport ) extern const long ERROR = 100; ..... [/code] … | |
I'm starting to learn c++. I use vista so lots of ide's dont work for me. Right now im trying visual c++ but things like cout are not understood when compiling. This may be a compiler issue. I all would like to know is a good basic (for beginers) ide … | |
[code] #include <conio.h> #include <graphics.h> #include <math.h> #include <stdlib.h> #include <dos.h> void serp(int level, int Ax, int Ay, int Bx, int By) { int poly[4]={Ax,Ay,Bx,By}; [COLOR="red"]setfillstyle(SOLID_FILL,YELLOW);[/COLOR] not working the way i want. if (level>0) { serp(level-1, Ax,Ay ,(2*Ax+Bx)/3,(2*Ay+By)/3); serp(level-1,(2*Ax+Bx)/3,(2*Ay+By)/3,(Ax+Bx)/2+sqrt(3)*(Ay-By)/6,(Ay+By)/2+sqrt(3)*(Bx-Ax)/6); serp(level-1,(Ax+Bx)/2+sqrt(3)*(Ay-By)/6,(Ay+By)/2+sqrt(3)*(Bx-Ax)/6,(Ax+2*Bx)/3,(Ay+2*By)/3); serp(level-1,(Ax+2*Bx)/3,(Ay+2*By)/3,Bx,By); } else fillpoly(2,poly); } int main(void) { int graphdriver=DETECT, … | |
I am trying to make a simple engine with WinAPI and I encounter this problem: [code] class Window { .... public: [COLOR="Red"]static HINSTANCE hInst;[/COLOR] .... }; .... .... .... int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; [COLOR="Red"]Window::hInst = hInstance;[/COLOR] .... .... } [/code] The … | |
The function that I am having a problem with is in the middle of this seperated from the rest of the code. [code=c++] #ifndef GRAPH_H #define GRAPH_H #include <string> #include "queue.h" using namespace std; class FileOpenError // Exception class -- cannot open input file { }; struct EdgeNode // Structure … | |
Hi, I'm curently creating a command line tool in VC++ 2008 Express Edition for myself which requires reading many files and merging them together. Everything is OK and during debugging (F5) there is not a single problem, but at run time (ctrl+F5) a problem with fread occurs at the same … | |
how can i make the computer block when im about to score, like do something like this XXXO? and how can i make the computer to make an OOOO for it to score too? im not allowed to use internet libraries in this one, need help | |
I'm about to start writing a genetic algorithm program which will be able to find the highest/lowest/whatever else values of variables required for an equation, and have come upon a point about which I am uncertain. I do not know whether I should store and work upon the values as … | |
I have a qns. How can i take out the number in a basic string input and assign them into different integer variable? Not a file input example - string input = "23/4/56" or "23.4.56" int a = 23, b=4, c = 56 [code==cpp] #include <iostream> #include <string> using namespace … | |
| I made this program but I need to figure out how to exit the program if the user does not input A,B,C,D, after three attempts. I'm new at building programs and I would be grateful for some help! #include <iostream> using namespace std; char studentAnswers(int); int main() { int i; … |
ok, i've got a question that i'm having trouble with Write a program that generates the factors of a number entered by the user. This program has the following requirements: 1. The user must enter a positive integer. If the user enters something else, your program should output an error … | |
Hi i am bilal n i am new here i need to make a program on Human simulation....... Well what i need is a code. when i am executing a program like am printing 'x' for infinite many times during execution when the console is printing x infinitely what can … | |
hi everyone.. i just want to know which of following operator can't be overloaded. a)== b)++ c)?! d)<= hoping for a Answer ASAP with explanation.. thanks.. | |
The sequence Fibonacci numbers begin with the integers 1,1,2,3,5,8,13,21....where each number after the first two is the sum of the two perceeding numbers, i want to write a loop to display this sequecnce numbers less than 500 . do we need to write 2 loops ? its not working for … | |
Hey all, I want to write a proxy for a local computer Basically i run a game server that talks [udp] to multiple people. However the server can be crashed. I want to write a program that captures the output of the server and sends it out on a different … | |
ok .guys .i m sorry for my previous msg.Can anybody tell me how i can take user 's value,then divided into 8 groups and then i have to make node for that 8 values.Here is my code [ICODE] #include<stdio.h> struct node { long int data; struct node* llink; struct node* … | |
Hi, Thank you for your support. I am new to C++ and have started working with classes. I understand constructors, accessors and mutators. I have a program that I am working on and I am implementing my classes. I have six classes and have completed four. The top two, Calendar … | |
hey, this is my first time posting so please don't be too harsh ... I am trying to write a program that allows the user to play rock paper scissors against the computer. I am able to create the whole game ... but now i need to put different sections … | |
I'm new to link lists and have to write a few modified functions from the book to do additional things. I have to modify insert to insert by the 2nd number passed in and have it replace that position and move the number that was there up. It's inserting the … | |
Hi. I'm trying to overload +=, -= and *=. [code=C++] /*error C2297: '+=' : illegal, right operand has type 'Matrix *' error C2114: '+=' : pointer on left; needs integral value on right*/ Matrix* Matrix::operator +=(const Matrix *const m) { if(x == m->x && y == m->y) myArray::Add(ppMyArray, m->ppMyArray); return … | |
Hi guys, I'm having some problem with my C++ assignment. Can't get this part down. [CODE=CPP] class Date { private: static const int daysInMonth[13]; int monthNo, year, day; string month; bool validDate, leapYear; public: void displayDaysInMonth(); void displayDate(); void enterDate(); void verifyDate(); void displayOptions(); void ahqError() {cout << "Error! Enter … | |
can anybody tell me what does this eroors mean: error C2676: binary '*' : 'class LongInt' does not define this operator or a conversion to a type acceptable to the predefined operator C:\Documents and Settings\dsproject.cpp(872) : error C2109: subscript requires array or pointer type C:\Documents and Settings\\dsproject.cpp(874) : error C2109: … | |
i have a code that you enter section after section. when your done, you type end, and it stops asking you to enter in stuff. My problem is, I can get it to detect when I type end. here is my problem: [code] cout << "\n\n\nTo start, enter each section … | |
Anyone have any idea how I would write a program that lets user input a floating point number and then either round up if number is like 4.5 our round down(truncate) if number like 4.49. Any help would be greatly appreciated. | |
This is my goal: - Search the list for a number and display how many times the number occur or display 'number not present' - Modify number and change each occurrence of a #, to the new number or display 'number not present' I have 2 functions. My first function … | |
the following example shows the problem: "int* pointername = new int" followed by "delete pointername" - no problem. however: "int* pointername = new int[8]" followed by "delete pointername" flags`an error during execution. (compile/built are passing ok). This happens with 2 very different compilers: vc++ (native) and djgpp one. looks like … | |
I get a problem when adding columns to a dataGrid. I keep adding columns with the code below. It works well until the column will come outside the right side of the dataGrids Widh. When it does, the program will get stuck for 2 minutes or so and the column … |
The End.