49,757 Topics

Member Avatar for
Member Avatar for djnstuff

Okay, what I'm trying to do here is set up a some-what simple battle system for a text based game... I'm having some trouble getting it to work correctly though. I want the Player's attack and the Monster's defense to be random each time the program loops (which is also …

Member Avatar for Shinedevil
0
320
Member Avatar for restrictment

Hello, I am trying to make an rpg, and I am having troubles with functions. I am currently working on the 'potion' aspect of my rpg, which I have highlighted in red. My question is this: Is it possible to make the function return money, potion number, potion size, etc? …

Member Avatar for restrictment
0
371
Member Avatar for kadji.kahn

I'm trying to make a program that will read two txt files, with GPA information (one for females and one for males) arranged like this: M 4.0 M 3.7 M 2.9 I've been instructed to used pass by reference void functions with no global variables. My major issue is how …

Member Avatar for kadji.kahn
0
172
Member Avatar for Shaitan00

My system has a service (Serv.exe) which starts as LocalSystem and should be running at all time, additionally on startup of the PC (auto logon) the user has a STARTUP application (App.exe) which runs. Sadly I've found that sometimes App.exe starts to run before Serv.exe has finished starting, and one …

0
112
Member Avatar for skarocks47

So i am just starting out learning C ++ and i was trying to make a BMI calculator. When ever i run the program and it prints the BMI number its a weird number. Not one it should get. Please can u help me out with my source? #include <iostream> …

Member Avatar for jonsca
0
189
Member Avatar for asxoliastos

Hello I am new to this forum so be patient.. I am currently having an issue with a map iterator well the code i am talking about: [CODE] leafnode<LeafEntry<recno_t> ,blocknum,char*,recno_t>* descend(Object<dimensionality,Type>& ob,nonleafnode<NonLeafEntry<dimensionality,Type>,dimensionality,Type>* rt,blocknum* leafblocknum){ std::map< int,NonLeafEntry<dimensionality,Type>* >* entries; std::map< int,NonLeafEntry<dimensionality,Type>* >::iterator it; leafnode<LeafEntry<recno_t> ,blocknum,char*,recno_t>* L; int i,elements; if(rt == NULL) …

Member Avatar for asxoliastos
0
131
Member Avatar for tararengan

hello, I am interested in implementing the push relabel max flow algorithm in C++. I see an implementation at [url]http://www.boost.org/doc/libs/1_40_0/libs/graph/doc/push_relabel_max_flow.html[/url] and don;t understand a good bit of it. I am in a position to describe my graph and if someone could explain how I can use this piece of code, …

0
84
Member Avatar for rkulp

I am trying to overload the Comparison Operators, to have them compare the RMR of two fitness trackers. I need to change the RMR from a double to an int for the comparison. How would I do this when the RMR is calculated by a function. Here is my code. …

0
111
Member Avatar for AdRock

I have a string which i can break down into tokens but what i want it to do is if it reaches a '//' it breaks out of the loop so no more tokens are added I have tried using this but it doesn't work [CODE]while (p!=NULL) { if(p=="//") { …

Member Avatar for AdRock
0
176
Member Avatar for xfreebornx

How can i sort this array pls.. [CODE]#include<iostream> #include<algorithm> using namespace std; int prompt(int x[]); void printreverse(int x[]); int main() { int x[5]; prompt(x); printreverse(x); system("pause"); return 0; } int prompt(int x[]) { for(int i=0;i<5;i++) { cout <<"Enter integers:"; cin >>x[i]; } } void printreverse(int x[]) { for(int i=0;i<5;i++) { …

Member Avatar for mrnutty
0
112
Member Avatar for teddyg18

So i am writing a simple prgm in which you enter the values of 2 matrices and multiplies them. [code] #include<iostream> #include<iomanip> #include<cmath> using namespace std; int main() { int i, j , k , l, m , n , o, p; cout<<"Enter The Rows And Cloumns And Of The …

Member Avatar for asxoliastos
0
122
Member Avatar for RonW56

Can someone help me with this problem I've been trying to do an else statement but it doesn't work here is the code.... for(int c=0;c<student_max;c++){ if(search_id==id[c]){ location=binary_search(id,student_max,search_id); cout<<"Student ID \tTotal \tGrade"<<endl; cout<<"-----------------------------"<<endl; cout<<search_id<<" \t\t"<<total[location]<<" \t"<<determine_grade(total[location])<<endl; //break; } //} else{ cout<<"Incorrect id entered"<<endl; break; } } }

Member Avatar for boblied
0
115
Member Avatar for rookanga

my assignment says to "Finish the header block on the function. " What is the header block? Is it the // (write information) or is it something else?

Member Avatar for Fbody
0
124
Member Avatar for isabellegagnier

I need to create a triangle in C++ that will take the user inputted letter (capital) and then create a triangle that will look like. I can only use nested loops NO arrays or strings Enter a letter: F F FE FED FEDC FEDCB FEDCBA here is the code i …

Member Avatar for isabellegagnier
0
229
Member Avatar for gtrippleb

I'm trying to write a c++ program that first asks how may people are in a party, then it takes that number to calculate how many times to ask what the next person wants to order. This is what I have so far. I can get the program to recognize …

Member Avatar for gtrippleb
0
113
Member Avatar for discovery-power

Hi All, I am trying to write a small program to better understand and practise writing blocks of code, I have written the one below but get the error message : "Linker Error undefined reference to WinMain@16 ld returned 1 exit status" // This program demonstrates a block of code …

Member Avatar for Fbody
0
128
Member Avatar for gedas

Hi everyone, Well I come to a point that I have run out of ideas and time and I’m going to ask for help from anyone that can help. I hope that there will be someone that could give me a hint how to solve my problem. About my problem …

0
92
Member Avatar for abraham james

May somebody pliz help explain to me line by line of this c++ coding cause I can't seem to understand it:- #include <stdio.h> #include <stdlib.h> #define SIZE 50 #define pi 3.14 void push(int i); int pop(void); void sort(int stack[SIZE],int numbers); int *pointer, stack[SIZE],numbers; void main(void) { int value,numbers,num,num2,num3,num4,array[5],num6,num7,num8; float num5,num9; …

Member Avatar for William Hemsworth
0
214
Member Avatar for Kaotic07

Hello, I have to write a program that merges 2 seperate files and then outputs to a single file. Each input file is to have numbers in ascending order and the output is supposed to compare these and then put them in ascending order. ex.: input1 = 1 3 5 …

Member Avatar for Kaotic07
0
149
Member Avatar for nalasimbha

I have the following struct [CODE]struct A { int a, *b, *c, *d; };[/CODE] I would be creating an array of A and then populating the member variable for each of struct in the array. The members b,c,d are allocated dynamically based on the value of A.a. To assign the …

Member Avatar for VernonDozier
0
108
Member Avatar for guguman

Hi guys, Sorry to ask a question as my first post. I'm totally new with c++ and I couldn't understand much about vectors. [CODE] case 1: { cout<<"Enter [S]avings Account , [C]hecking Account,[G]eneral Account"<<endl; cin>>selection; if ((selection == 'G') || (selection == 'g')) { acc.push_back(newAccount); cout<<"New account added"<<flush<<endl; break; }//end …

Member Avatar for SVR
0
138
Member Avatar for Excizted

Hi. I have a problem I cant find a solution to, since I am unable to describe the problem in a searchable way. I make a hWnd for each contact the user has: [CODE=C++]contact[atoi(rowC[0])].hWnd = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG4), hWnd, messengerBox);[/CODE] messengerBox is defined like this. [CODE=C++]BOOL CALLBACK messengerBox(HWND hWnd, UINT message, …

Member Avatar for Excizted
0
429
Member Avatar for UKmason

[CODE]double distance (double angle, int mps, double earth_gravity) { double earth_distance; double speed_sqr = mps * mps; earth_distance = speed_sqr * sin(2*angle) / earth_gravity; return earth_distance; }[/CODE] its supposed to come out at = 3831.57 intead it ends up being =3155.52 anyone know what im doing wrong?

Member Avatar for Fbody
0
267
Member Avatar for discovery-power

Hi All, I have just started learning how to write C++, I have written my very first very simple program using notepad and saved the file as simple.cpp. So my question is how do I compile or build my program into an executable file, I understand I have to use …

Member Avatar for discovery-power
0
158
Member Avatar for discovery-power

Hi All, I am currently learning C++ and i have started to write some small programs that explain operators, integers and values, my question is this. How do I make my programs stay on screen, at the moment I run my program it displays the message on screen for about …

Member Avatar for discovery-power
0
162
Member Avatar for Raghusys

I have been told to write a c or c++ program for TCP server client program with some conditions that is listed below: You are to implement a synchronization server managing barriers. Your synchronization server should be a stand-alone single threaded process that continuously awaits requests from other processes (the …

0
73
Member Avatar for sibobo

im newbies in c++... my task is to translate code Morse into alphabet an count the word i use... the problem is i dont know how to use the ifstream to read and use the code Morse that must be kept in .text file i only manage to write the …

Member Avatar for sibobo
0
158
Member Avatar for mevkurray

Hi all. Before you all scream "search the forum", i already have, this and many others. cant seem to find the problem with my code. Basically, i have a fairly large text file, each line consisting of 20 fields seperated by a `. i have got my program to split …

Member Avatar for mevkurray
1
1K
Member Avatar for just4why

I would like to automatically generated staff number before generated the staff number i would like to check the staff.txt is the staff number exist. If exist then it will get the last's staff number and continue to adding. But the code that i creating it wont work. Please help …

Member Avatar for just4why
0
108
Member Avatar for amar singh

[code]#include<stdio.h> #include<conio.h> main() { int a,i,fact=1; clrscr(); printf("Enter a number "); scanf("%d",&a); for(i=1;i<=a;i++) { fact=fact*i; } printf("Fact of %d is %d",fact,a); getch(); }[/code]

-1
67

The End.