49,761 Topics
| |
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 … | |
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 … | |
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 … | |
[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]; … | |
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) … | |
[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) … | |
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 … | |
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 … | |
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 … | |
[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 … | |
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 … | |
[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 … | |
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; }; … | |
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 … | |
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 … | |
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 … | |
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++ … | |
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! | |
#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. | |
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 … | |
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. … | |
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 … | |
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]; … | |
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, … | |
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 … | |
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 … | |
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, … | |
[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 … | |
[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 … |
The End.