51,593 Topics

Member Avatar for
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
158
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
127
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
360
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
136
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
133
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
115
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
157
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
231
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
407
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
163
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
182
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
348
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
59
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
136
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
310
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
434
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
161
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
138
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
138
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
890
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
204
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
41
Member Avatar for mybluehair

I got a snippet off the web of how to download a file from online in c++ console with the curl library. so I installed curl, and copied the code snippet, but it doesnt work. Can someone show me whats wrong? [code]#include <curl/curl.h> #include <cstdio> // link with libcurl. eg. …

Member Avatar for shankhaa
0
1K
Member Avatar for mikeblitz

guys i need help ASAP since i need to submit this miniproject and i need 1 more minor questions need asnwered. the C++ coding is given below, i need to change it to function type but giving out the same output. #include <iostream> #define SIZE 7 using namespace std; int …

Member Avatar for Schol-R-LEA
0
246
Member Avatar for Hiiero

How would I go about refining a triangle? So far this is what my code looks like,not finished by far [CODE] class point {public: point(){} point(double i, double j,double k){x=i; y=j;z=k;} ~point(){} double getx(){return x;} double gety(){return y;} double getz(){return z;} bool operator == (point p){return (x==p.getx() && y==p.gety() && …

Member Avatar for thines01
0
180
Member Avatar for ztdep

Dear friends: I need the vector computation as follows, for example: A=[1,2,3], B=[3,4,5] C=A+B; C=A-B;C=A+alphs*B; Could you please suggest me a C++ numerical library for this kind of computation. Regards

Member Avatar for ztdep
0
177
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 jackmaverick1
0
131
Member Avatar for surakesh

[CODE]using Excel = Microsoft.Office.Interop.Excel; namespace program { private void cmdOpen_Click(object sender, System.EventArgs e) { FileSystem.FileOpen(1, inputfile, OpenMode.Input, (OpenAccess)(-1), (OpenShare)(-1), -1); // 1 : excel file Excel.Application MyXl; MyXl = new Excel.ApplicationClass(); MyXl.Visible = true; Excel.Workbook xlWorkbook = MyXl.Workbooks.Open(inputfile, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, …

Member Avatar for thines01
0
282
Member Avatar for eavila

Hey, so as you can tell, this is my first attempt at writing a class. I put in a mock int main() in order to follow what exactly is going wrong. As far as I can tell, every time the struct in push is used, it always has the same …

Member Avatar for gusano79
0
145
Member Avatar for blackrainbowhun

Hello everybody! I'm participating in a competition, and I just finished my program. It doesn't really matter what it does, and how. I have encountered a bug I think. I'd appreciate every kind of help, because with the problem, my solution fails for the test file. I have to read …

Member Avatar for Schol-R-LEA
0
173
Member Avatar for Akusa

Okay so for my beginners c++ class we have to make game for our final project. The game is a simple shooter type game with ascii chars and stuff for the player and the enemy. We covered up to 2d arrays in class and then the teacher gave us the …

Member Avatar for Schol-R-LEA
0
429
Member Avatar for stereomatching

Now I have a lot of airplanes, in the ideal world the interface of the airplanes(or anything) should be unify but for some kind of weird reasons, the class for different airplanes are designed like this [code] struct airplane_A { fly_A(); speed_up_A(); //blah blah blah }; struct airplane_B { fly_B(); …

Member Avatar for stereomatching
0
106
Member Avatar for TheWickedKid

Hello... I'm practicing c++ and I'm trying to create a program with register and login in it.. the problem is I'm trying to compare the register username/password to the login username/password but even though the comparisons are right it's not working.. [CODE]#include <Windows.h> #include <iostream> #include <iomanip> #include <string> #include …

Member Avatar for Ancient Dragon
1
16K
Member Avatar for emitremmit

I am having problems with my program to add and multiply two 4 bit binary numbers. The part in which I am currently having trouble is when I run the program the output for the addition function is not correct. Instead of displaying the correct answer it is just displaying …

Member Avatar for emitremmit
0
277
Member Avatar for mc3330418

I have a text file with names, wins, losse. I have to take those in a write a function to find the average, and a function to sort the names in alphabetical order. I finally got everything into arrays but I cant do anything else. I don't think I'm understanding …

Member Avatar for Ancient Dragon
0
132
Member Avatar for Hiiero

I am currently trying to create a list of skills and each list of skills generates 3 to 10 skills to put in the list and then randomly generates the skills that it places in that list. But I don't want skills repeating,meaning if I have 8 skills going in …

Member Avatar for Hiiero
0
147
Member Avatar for kjs5533

Yo guys! How's it going? To give you a quick gist of my goals : I want to allow the user to enter a bunch of criteria for a book (title, author, etc) so I made a structure. Then I store that structure in an array so they can enter …

Member Avatar for pseudorandom21
0
460
Member Avatar for zaneulhaq

Hey guys, what i'm basically trying to do in this code is to write an array which is automatically written to a txt file in the order I have shown below, however, I not only get this error [code] --------------------Configuration: testmtl - Win32 Debug-------------------- Linking... LIBCD.lib(crt0.obj) : error LNK2001: unresolved …

Member Avatar for Schol-R-LEA
0
267
Member Avatar for coolbeanbob

Not sure I understand what is going on with setw(). [CODE] I would expect the program below to output something like this 77 77 77 77 Instead, it does this: 77 77 77 77 77 77[/CODE] Why are the first three 77's not indented? [CODE]#include "utility.h" // setw example #include …

Member Avatar for Schol-R-LEA
0
226
Member Avatar for addision

Ugh! need help. Ok I am creating a form to calculate a conversion, actually one of 24 conversions to be decided by radio button. I placed the code to make the conversion under the "checkchanged" event of each of the radio buttons, turns out that's not a good idea as …

Member Avatar for thines01
0
245
Member Avatar for rajatchak

[CODE] #include<iostream.h> #include<stdio.h> #include<fstream.h> #include<string.h> class qa { char question[35]; char option[4][20]; int ans; //correct option no (eg 0 1 2 3) public: void getques() { gets(question); cout<<endl; } void getopts() {cin>>option[0]>>option[1]>>option[2]>>option[3]; } void getans() { cin>>ans; } }; void main() { int n; qa q; fstream file1; file1.open("questions.dat",ios::out); cout<<"\n …

Member Avatar for rajatchak
0
216
Member Avatar for Diogo Martinho

Hello everyone. I'm having quite a rough time with my program because my code isnt just working [CODE]#include <string> #include <iostream> #include <string> #include <stdlib.h> #include <windows.h> using namespace std; #include "DBase.h" #include "Client.h" list <Client> l; DBase *example; int main (void) { string user= "my username"; string pass = …

Member Avatar for Narue
0
275
Member Avatar for gpraveenkr04

Consider : char *n=123456; I want to convert it into: int b[]={1,2,3,4,5,6}; i.e. b[0]=1; b[1]=2; ..... b[5]=6; Please suggest the code to perform the same. Thank you....

Member Avatar for Narue
0
50
Member Avatar for airtoncbr

I've Just finished a program and it's taking various errors. Can you show me Where its wrong? [CODE]/******************************************************************** * Autor: Antônio Airton Cabral Neto * * Compilador: BC 3.1 Borland * * Ambiente: Tela de scroll do DOS * * Modelo de memoria: Small * * Data: 12/09 e 14/09 …

Member Avatar for airtoncbr
0
407
Member Avatar for riahc3

Hey I was wondering how I could write a binary file in Java with code in C++ using the reinterpret_cast function. If I remember the line correctly (not currently at work) it was: [CODE] file.write=reinterpret_cast<char *(&x)>,sizeof x; [/CODE] with x being a variable. How can I do that in Java? …

Member Avatar for riahc3
0
939

The End.