2,025 Topics
![]() | |
I am a C++ beginner and I am stuck. I can't get the random number generators to run properly, specifically the random number generators are all coming up with 1 . The point system is not running properly either, I'm sure it has something to do with my do-while loop. … | |
[TEX=how to find the shortest path between undirected countries] Heloo! i m again sending my code with few more modifications. please tel me how to find the shortest path between undirected countries. thanks.[/TEX] [CODE= C++] #include<iostream> #include<fstream> #include <string> using namespace std; class Node { friend class list; friend class … | |
Below is my problem... Here is my code... [code=cplusplus] #include<iostream> #include<iomanip> //allows me to use setflags/showpoint and set precision #include <stdlib.h> //for exit(1) #include <fstream> # include <stdlib.h> # include <cstdlib> using namespace std; int main() { double s1, s2, s3; ifstream inf; inf.open ("C:\\CS201HWASSGN6INPUTFILE.txt", ios::in); ifstream infile("C:\\CS201HWASSGN6INPUTFILE.txt", ios::in); //Input … | |
Hello!! I wanted to know that does anybody can provide me the source code of : how to find the shortest path between different countries.? I m sending u my code its in Visual C++ 6.0 I m doing it with adjacency list. done with adjaceny list but dont know … | |
Below is my problem... I think section 1-3 are okay, but I am having problems with sections 4-7, Any help would be great. I also need to load these from a file... I just loaded the array by initializing the values as I thought I could start there check my … | |
Hi everyone, A couple of questions, please. 1) In my Airports class I am trying to get input data from a text file and put it inside the variables of an airport object that I'm going to create. 2) Then I'm going to try and store my Airport objects inside … | |
help plz...I have to create a program that multiplies matrices...those elements in the array must come from a file or reads a file...I have constructed these codes but this program lets the user type their number, not read from a file..I have these code so far...[CODE]#include <cstdlib> #include <iostream> #include … | |
hello i have a program that is written by Borland C++Builder 6 it is a program for writing binary files using ofstream. but when i ship this program to Borland C++Builder 2006/2007 and compile it,the run time of program increased very much. for example you can test this standard code … | |
Hi, I'm making a small program that sends data to a program that is constantly moving around. (to practice my c++)and it needs to be able to read file paths (C:\\Dev-Cpp\\...etc) from a file and store it in a char array (this is all I could figure out worked for … | |
Ok, I was trying to write a program that formats a plain text file to the formatting standards of gamefaqs.com (no trailing spaces and no more than 79 characters per line). To my eyes, my code looks perfectly fine and effective. If I run it with anything but a file … | |
I'm trying to use fstreams to read and write binary data to a file with the following code: [CODE]#include <fstream> #include <iostream> using namespace std; int main(){ ofstream out("test.data", ios::binary); for(uint i=0; i<10; i++){ uint outcount = i+100; out.write((char*)&outcount, sizeof(uint)); } ifstream in("test.data", ios::binary); for(int i=0; i<10; i++){ uint incount; … | |
Hi, all. I am very new to C++ and am close to losing my mind with the homework. We are asked to generate a multiplication table using a 'for statement'. User is to input a number between 1-12; the program will generate a multiplication table and should loop for no … | |
Hi I have a small question, probably quite obvious but I cant seem to figure it out. When using the ifstream or any other stream you can tell if it was sucessfull in its last event. For example: [CODE=CPP] #include<fstream> int main() { ifstream in("test.txt", ios::in); if (in) { } … | |
i've created a linked list which stores some info about documents such as code,title,creator,filename,... i've also stored some info about some other documents in a *.txt file i've got a search function in my program that gets a code from the user and tries to find that code either in … | |
Hi guys ! This has been killing me for 8 hours Things work well I'm compiling this way : [QUOTE] g++ -Wall -o prog prog.cpp -L/usr/local/sesam/lib -Wl,-rpath /usr/local/sesam/lib -Wl,-rpath,/usr/sesam/lib -ldl -lc[/QUOTE] But when I add a link to /usr/local/sesam/lib/libssv.so that i need [QUOTE]g++ -Wall -o prog prog.cpp -L/usr/local/sesam/lib -lssv -Wl,-rpath … | |
This is the file I will be calling from, basically it stores something into a file called "temp.txt, so let's assume that it works and the problem is not here. This is the "file.h" file. [CODE]#include <iostream.h> #include <fstream.h> #include <string.h> #include <stdlib.h> ofstream output_file("temp.txt", ios::out); class NUM_STUD: { public: … | |
Hi, I'm trying to update a file with an information in a binary tree. However my algorithm is working only for one NODE. Any suggestion will be appreciated! [CODE]void Arbol::updateFile() { Nodeptr p = miArbol; // myTree Recorrer(p); cout << "File updated!" << endl; cout << endl; } void Arbol::Recorrer(Nodeptr … | |
i got my code to finally compile but, now im getting 5 linker errors that i have no idea why im throwing them the errors are: [code=cpp] football.obj : error LNK2019: unresolved external symbol "public: void __thiscall Football::SearchMatches(struct Match * * const,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int)" (?SearchMatches@Football@@QAEXQAPAUMatch@@HV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) referenced in function … | |
hi i am trying to make a function for calculating the commercial boat fee, so if a boat is commercial, the program will add additional fee to the total sum, and if its not it won't add anything to it. i got the function to run, but all i am … | |
well my struct is fix but i have new errors i hve never seen before : here are the errors [code=cpp] football.cpp(194) : error C2664: 'void Football::SearchMatches(Match *,int,std::string)' : cannot convert parameter 1 from 'Match *[2000]' to 'Match *' football.cpp(205) : error C2664: 'void Football::SearchMatches(Match *,int,std::string,int)' : cannot convert parameter … | |
When I run the follwing code: [code] #include <iostream.h> #include <string.h> #include <vector.h> #include <fstream.h> using std::string; using std::vector; void exchange(vector <int> &array,vector<string>&array1); void main() { ifstream fin,f2,f3,f4; //First name input vector <string> fname(25); fin.open("firstname.dat", ios :: in); for( int i= 0;i<25;i++) fin>>fname[i]; fin.close(); //Second name input vector <int> fnum(25); … | |
ok i have wrote this program and been trying to break into a class called football , but i keep getting an: error error C2228: left of '.Season' must have class/struct/union i have tried moving my stuct around in and out of the class but im not sure how to … | |
//person class class Person { //private: public: char name[30]; char type[20]; char date[10]; char id[10]; Person(char pname[],char ptype[],char pdate[],char pid[]); void addPerson(); void personDelete(); char personFind(char pid[]); }; //this function find with id and return the name of the person char Person::personFind(char pid[]) { fstream readFile; readFile.open("employee.txt",ios::in); if(readFile.fail()) { cout<<"Cannot … | |
Hi, I am having a problem with returning a 2d array back to the main in my program. The program reads in a matrix from a file, then it has to multiply etc, however i cannot get the print function to work since the array that is made in the … | |
hi i ave an assignment on point of sale terminal where i have to write a program so that it displays the product ID, amount of product , cost of each product and then the total cost. the following code shows how i've started it. Could some one tell me … | |
New to classes. Getting alot of errors when calling the private member variables (from down in main). Most are telling me either i can't access the private member variable IDs or the other member variables i'm attempting to access (debit, credit, balance) are undefined ('identifier not found'). Also getting 'overloaded … | |
I am creating a book database using C++. I am using a book structure which contains all the information for each book that I create. The problem I am having is that I want to be able to search the file I am printing the books to for a specific … | |
ok after somet time im now ready into breaking my code apart into 4 class Sports,NBA,NFL,MLB, here is the original code [code] #include <iostream> #include <fstream> #include <string> using namespace std; // definition of strct that will hold all information of match struct Match { string Season; string Team1; string … | |
[code]#include <iostream.h> #include <string.h> #include <vector.h> #include <fstream.h> using std::string; using std::vector; void function(vector<string>&fn,vector<string>&fnum,vector<string>&ln,vector<string>&lnum); void main() { ifstream fin,f2,f3,f4; //First name input vector <string> fname(25); fin.open("firstname.dat", ios :: in); for( int i= 0;i<25;i++) fin>>fname[i]; fin.close(); //Second name input vector <string> fnum(25); f2.open("firstnum.dat", ios :: in); for(int i= 0;i<25;i++) f2>>fnum[i]; f2.close(); … | |
I haven't been on the forums for over like 20 days because I have been busy with things, and then my internet died. Not that anyone cared, but I'm just saying this so Vmane won't think that I just copied his code solution and ran away if he stumbled upon … | |
Euhmm Ok i got some error that tells me that i can't open the program because there some error in my syntax but I really don't know where is the problem it self. #include <iostream> #include <iomanip> #include <cmath> #include <fstream> using namespace std; void voircatalogue(fstream&); void ajoutitem(fstream&); void ajoutclients(fstream&); … | |
[code=cplusplus] #include <iostream> #include <iomanip> #include <fstream> using namespace std; void DisplayTitle(); void DisplayBal(double); void GetData(int& , double&); double ProcessCheck(double, double); double ProcessDeposit(double, double); double ProcessATM(double, double); double ProcessSvcChg(double); struct transrec { double credids; double debits; double service charges; }; const double CHARGE = 10, ATMFEE = 2; int main() … | |
I have succesfully done this but with one error. using ... ifstream input("infile.txt",ios::in) while(input.good()) { input.getline(file,100); outputfile<<file<<endl; } then I have some new code that writes this into another file. You may laugh when you hear this but the problem is that it add an extra line to the output … | |
I've created, and written to a file. It lets me do all of that just fine, but when I try to delete the file it says that I do not have permission. Is there something wrong with my code?: [code] #include <cstdlib> #include <iostream> #include <fstream> using namespace std; int … | |
I have an assignment. I have to ask the user for a string to search for in a file. The program reads each line of the file and compares each string to the user's string. It then displays the line of the file the string was found on. Lastly, I … | |
Hello, all, I am pretty new to C++ and I need to write a program for calculating radio propagation path loss based on ray tracing, C++ is used for its faster processing rather than MATLAB. I have a question about passing 2D arrays between functions. One of the files looks … | |
I am going over some of my quizzes with questions I did not get right and was wondering if someone could help me w\ a few of them... What will the following code print to the screen: [code=c++] int num[15] = {3,2,8,7,1,5,6}; for (i=0; i <15; i+=3) { cout << … | |
In my program i have three sperate vectors that store the students last name, first and score. I need to sort it by last name and print the contents of the vectors lastname, firstname: score. Well i have got it doing that for the most part. But after it sorts … | |
Hi everybody, I'm working on project to my tutorial, it's called Library and basically it's reading data from text file and inserting it in structure. Output part is String Grid. It should be able to sort books alphabetically, add and delete books manualy etc. I'm using Borland C++ Turbo. Here … | |
Hey. I get bored so muck around with c++ and i have made this: [CODE=C++]/* My shop program*/ #include <iostream> #include <fstream> #include <conio.h> #include <time.h> using namespace std; int main() { double quantity; unsigned int itemNo; time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime … | |
just a small issue with my program...I am finishing it up and the issue I have is I need to make me decimal points line up...the array is up and perfect just need some assistance in setting up the widths [code=c++] #include <iostream> #include <fstream> #include <iomanip> #include <string> using … | |
can someone show me how to code the median if it is an even number [code=c++] #include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; void Fill_Array(double Size[], int& count); void Print_Array(double Size[], int count); double Calc_Average(double Size[], int count); void Sort(double Size[], int count); void Swap(double& v1, … | |
i'm working on the "removesong" function. i need to check the vectors that already have the data separated and stored in them, and i need to see if the entered song title and artist name exist. if they do, i need to replace that same vector location with an empty … | |
Hello, I am trying to load data from a testfile.txt file which contains ten records and 3 fields with numbers into a 2 dimensional table and then print it. I am not sure if I am accesing the data correctly and placing it into the array. I get no output. … | |
hey every body, in my project-Emergency room Simulator- i should open file for all patient if he didnt have one, so, when the patient come, i will ask him if he has a file, if yes, i will read his information and add some more in it, if not i … | |
Hi, I need help with a Golf Stats Program I am trying to complete. It is a dat file. My averaging functions are not working. Can someone suggest what I can do to correct the problems with both averaging functions? main [code=cplusplus] #include <iostream> using std::cerr; using std::cout; using std::cin; … | |
Hey guys, I have been working on this program for my entire semester. I got it down to do what I want I think... except when I compile it, I get no errors or warnings (using Dev) and when I execute it runs through half of it and it stops … | |
the program keeps track of a persons musical library. addsong checks to make sure that the data being entered is not already present in the file. if it is present, it is not added, if it isn't present, it is added at the end of the file. the removesong function … | |
the "addsong" function working, i just dont know how to tell the compiler to [B]skip over[/B] elements in the vectors with empty strings, when writing the new data to the music_library file. this is because i have to write a remove song function where, after the song is removed, the … | |
i'm writing a program that reverses the first 600 characters of a bitmap picture (it basically swaps character 0 with char 599, 1 with 598 and ......) This is what i've written so far but it's not working [code] #include <iostream.h> #include <fstream.h> #include<conio.h> int main() { char c1,c2; int … |
The End.