49,761 Topics

Member Avatar for
Member Avatar for jankeifer

can anyone please help me in to creating a client-server using this game? [CODE]#include <iostream> #include <iomanip> #include <map> #include <time.h> #include <cstdlib> using namespace std; //displays the instruction of the game void displayInst(){ for ( int b = 0; b < 28; b++ ) cout << "* "; cout …

Member Avatar for vijayan121
0
146
Member Avatar for pseudorandom21

If ASIO had better documentation I could probably have found for myself an answer, but instead... Is there a way to determine bytes available to read using the asio::ip::tcp::iostream ? I really like the tcp iostream because it's super-easy to use, but I haven't found it exactly feature-packed. Does it …

Member Avatar for vijayan121
0
178
Member Avatar for DACP

What should I do to change this code using else-if so that it will read the first character in my input text file and then determine which equation to use? For example, the first line in the input text file is A 4 8 and the second line is M …

Member Avatar for mrnutty
-1
2K
Member Avatar for imrandavidm
Member Avatar for MugANDGlass

[CODE]void search() { char id[12]; node *p = head; system("cls"); { cout<<"Search ID: "; cin>>id; } while ((p!=NULL) && (strcmp(id,p->id)!=0)) { p = p->next; } if(p==NULL) { cout<<"No such ID in our list"<<endl; delete p; } else cout<<"We have this ID in our list"<<endl; } void remove() { char id[12]; …

Member Avatar for v3ga
0
155
Member Avatar for jayanta87

I got the error with the following code :- controller.h [CODE] class control{ public: void casino_game(); void register(registration &); }; [/CODE] controller.cpp [CODE] #include<iostream> #include "controller.h" #include "ui.h" #include "registration.h" #include "db.h" using namespace std; void control::casino_game() { ui uiobj; registration R; db dbobj; int loop=1; uiobj.mainui(); int choice=uiobj.get_choice(); while(loop==1) …

Member Avatar for Ancient Dragon
0
126
Member Avatar for MugANDGlass

[CODE]void Load() { book *newptr,*p,*q; string id,title,author,year,price,date; ifstream file1; head = NULL; file1.open("books.txt"); if (file1.fail()) { cout << "Error opening file.\n"; exit(1); } while (!file1.eof()) { newptr = new book; // getline(file1,id); getline(file1,title); getline(file1,author); getline(file1,year); getline(file1,price); getline(file1,date); //copy values from the file to the newptr newptr->id.assign (id) ; newptr->title.assign (title) …

Member Avatar for MugANDGlass
0
353
Member Avatar for Hiiero

I am loading a set of integers int a binary which is no problem, its when Im trying to increase their frequencies I am running into some difficulties. As it stands the program crashs if any of the numbers repeat themselves, any suggestions? [CODE] void BST::insert(int d) { tree_node* t …

Member Avatar for mrnutty
0
133
Member Avatar for sodha125

I need to make multiple choice and a switch statement is used to check for correct answers. Also introduce a random element whereby the user can roll a dice and skip the following question if he gets a 6 (other rewards/penalties can be introduced for different dice values). this is …

Member Avatar for Chuckleluck
0
2K
Member Avatar for vyrte

hello! i have a problem with my code,it keeps crashes at the following point: [CODE] [B]a.h[/B] class Value{ ..... public: Value(char* b); } class A{ private: ....... Value* value; ........ public: A(char* tok); } a.cpp A::A(char* tok){ ....... *value = Value(tok) ......} [/CODE] i can tell i do something wrong …

Member Avatar for Moschops
0
126
Member Avatar for Jim887

[CODE] void init(); void tim(); int str; int per; int tou; int rea; int qui; int wou; void main() { init(); tim(); cout<<"\nPerception-" <<per<<"\nStrength -"<<str<<"\ntoughness -"<<tou<<"\nWounds -"<<wou<<"\nQuickness -"<<qui<<"\nReactions -"<<rea; system ("pause"); } void init() { cout<<"You have 45 points to put into stats"<<"\nPerception-1pts. per \nStrength -2pts. per \ntoughness -4pts. per …

Member Avatar for Moschops
0
114
Member Avatar for Hiiero

The program below makes two classes that when calling their generate functions in a .cpp file generates a list of soldiers and then a separate list of skills, I want to combine these 2 lists,that way you can say Soldier 1 has skill 1,4,7 while Soldier 2 has 3,4,5,6,7,8. How …

Member Avatar for thines01
0
152
Member Avatar for MugANDGlass

[CODE]void Load() { book *newptr,*p,*q; char id [12]; string title; string author; int year; float price; ifstream file1; head = NULL; file1.open("books.txt"); if (file1.fail()) { cout << "Error opening file.\n"; exit(1); } while (!file1.eof()) { newptr = new book; // file1.getline(id,12); getline(file1,title); getline(file1,author); getline(file1,year); file1.getline(price); //copy values from the file …

Member Avatar for Lerner
0
228
Member Avatar for zbar

Hi people, need some help in closing the window after program execution has completed. I am running Turbo c++ 4.5 for windows under Win7 32. Thanks. Heres the sample code: //Read and display test customer file #include <stdio.h> #include <conio.h> #include <iostream.h> struct customer { char c_name[50]; int i_age; }; …

Member Avatar for tapaninyc
0
3K
Member Avatar for psandip

Hello everybody, While reading C++, I have been looking into iostream header file to understand a bit more about header file organization. I am not able to understand much of the code in there. For example the header starts with #ifndef _GLIBCXX_IOSTREAM. Does this check whether _GLIBCXX_IOSTREAM has been defined …

Member Avatar for Fbody
0
400
Member Avatar for Hlopster

Hey Guys, i'm new to the forum and I would appreciate any help. I'm writing a program where the user needs to choose 5 numbers from 56. At the same time I'm using loop screen out numbers outside of this range. As a result only the 1st number out of …

Member Avatar for Hlopster
0
161
Member Avatar for addision

I think I have been asking the wrong question. I am creating a series of radio buttons on a form (6 of them). I would like the radio button to pass a parameter to the main function telling the main function that it was the one selected. I do not …

Member Avatar for addision
0
180
Member Avatar for challanger

Hi I am having trouble trying to connect to a local MySql db using the MySQL Connector/C++. I was able to successfully compile the bellow code but when I run it results in a Segmentation fault. I am trying to run this on a Windows XP machine using the g++ …

Member Avatar for challanger
0
1K
Member Avatar for jankeifer

can anybody help me making this program? i've based my game from this site. [url]http://www.education.com/activity/article/Tick_tack_toe_Added/[/url] hope that someone can help me.. i've been stuck coding that for almost 6hrs but still no progress. thank you!

Member Avatar for jankeifer
0
345
Member Avatar for Salman Ahmed Q

#include<stdio.h> void main(void) { int n,j, fact; printf("\nENTER A NUMBER:"); scanf("%d",&n); fact=1; for(j=1;j<=n;j++1) fact=fact*j; printf("\nThe factorial of %d is %d",n,fact); } I have problem in for(j=1;j<=n;j++1).Please help me.

Member Avatar for skaa
0
58
Member Avatar for desolatebeast

ok so i need to ask the user for a file to use for the input, then i need to read the input a line at a time, because i am trying to take postfix expressions from the file and evaluate them then return the result in the user's choice …

Member Avatar for v3ga
0
134
Member Avatar for suptboyr

Input a time specified as the hour(1-12), minute (0-59), and the meridian (A or P for A.M or P.M); then output that time in the form HH:MM A.M/P.M. Then enter a nonnegative number of minutes and output the time that is that number of minutes later than the original time. …

Member Avatar for shweta11
0
307
Member Avatar for Chuckleluck

Hello, I'm wanting to have multiple .cpp files in one project. I have three files: "Main.cpp" "Secondary.cpp" "Main.h" This is the content of Main.cpp: [CODE]#include "Main.h" #include <iostream> void Engine(); int main() { b = 10; a = 5; std::cout << a << b; Engine(); } [/CODE] This is the …

Member Avatar for Chuckleluck
0
430
Member Avatar for Firzin

I'm getting an undeclared error in my main program at line 45. Can anyone find out what is causing it? Main [CODE]#include <iostream> #include <string> #include <fstream> #include <cstdlib> #include <vector> #include "playlist.h" using namespace std; int main (int argc, char*argv[]) { ifstream fin; int lineCounter = 1; string parsedLine[NUM_OF_FIELDS]; …

Member Avatar for Schol-R-LEA
0
159
Member Avatar for ryantoss

Hello everyone, i'm been practice C++ for a while just a new hobby in technology. i start with mathematics with numbers and some cout, cin function in other program like excel i can enter series of number and after that we can: 1. Sum them up 2. Divide them, multiple, …

Member Avatar for jmichae3
0
134
Member Avatar for cgray1989

I'm trying to figure out how to do this program. A program is required to print and read a series of exam scores for students enrolled in a math class. The class average is to be computed and printed at the end of the report. Score can range form 0 …

Member Avatar for jmichae3
0
136
Member Avatar for allynm

Hello everyone, I am working in the latest version of MinGW (downloaded 12/12/2011). I am attempting to compile a .rc file using Windres.exe. I use the command: windres -O coff about1.rc -o about1.res. Windres generates perhaps 100 or more warning messages saying "null characters ignored", and then it terminates with …

Member Avatar for jmichae3
0
854
Member Avatar for Assassin7893

Guys, I'm actually almost done. Basically what I have to do is to read from file with a list of words, sort them alphabetically and write them into another file. I am almost done, but the only thing is, the assignment says that we shouldn't change the case of words, …

Member Avatar for v3ga
0
2K
Member Avatar for sodalee702

[B]I have a question, pls help, thanks very much.[/B] Try to write a C program which can analyze the input of the user in the following aspect. 1. vowels 2. consonants 3 digits 4 white spaces 5 others You must use the logic of pointer to do this analysis in …

Member Avatar for v3ga
0
198
Member Avatar for stereomatching

[code] void airplaneTest::SetUp() { ASSERT_TRUE(this->msg_handler_.install_airplane(GetParam()) << "Failed to install airplane " << GetParam(); airplane_id_ = airplane.airplane_id(); } void airplaneTest::TearDown() { ASSERT_FALSE(airplane_id_.empty() ); ASSERT_TRUE(this->msg_handler_.remove_airplane(airplane_id_)) << "Failed to remove airplane " << GetParam(); } //a lot of test case put into TEST_P [/code] Google test will reinstall the airplane for diffrent test …

0
38

The End.