2,025 Topics
![]() | |
I need help. I need help on reading input file using .READ and normal streams. I also need help on sorting input file and passing data to the structure rec and output it without showing any null characters..... here's my confusing code... #include <iostream.h> #include <iomanip.h> #include <fstream.h> #include <string.h> … | |
Guys, Either there is a bug in the compiler or I'm getting dumber by the day. I want to read an entire file into memory. (Very small file, so no worries about size here). I followed the example here (from [url="http://www.cplusplus.com/"]www.cplusplus.com[/url]) [code]// reading binary file #include <iostream.h> #include <fstream.h> const … | |
Hi! I paste a short sample for a subfunction of a class of mine. I get an error about the declaration of "of" and I'm not quite sure what's wrong :rolleyes: To this I would like to ask if anybody knows how can I check in a new file for … | |
[B]This message is long, just focas on the bold parts which their aint that much, dont mind the smilies Plz help me solve the compile error[/B] [B]An overview of my program[/B] The program takes the results from a html form(questionaire) than either updates the files with the results or adds … | |
Hi, I need to use clearcase command mkview which is deprecated command of start_task,but i need to use only mkview in my perl script to build view.when i use mkview in my perl script as $command=`mkview -i mybranch -s /vws/xxx -v /vob/ios `; when i run my perl script,It is … | |
Hello Im hoping someone could help me with this code, i have used comment notations to show problem areas. If anyone has suggestions on how to improve this code or see's something i have used that may be wrong(mixing the wrong class or code) please reply. [code]#include <fstream> #include <iostream> … | |
Hi everyone, i am a student of IT and i am trying to read a text file and load it into a records of nested structs. I understand the logic how to do it, but i had a few problems. the txt. file contains : [code]John Smith 125 2004 Daily … | |
I'm running into to this problem where the fstream is suppose to read data off a file to store in arrays. I cant continue with my project until the program reads it right. It is skipping some of the datas. Can I get a little help? Thanks in advance [CODE] … | |
For some reason the code is not printing the error string in the output screen of the operating system. Go figure? This code is directly out of the book. [code]#include<iostream.h> #include<fstream.h> #include<stdio.h> #include<stdlib.h> #include<conio.h> ofstream fileout; ifstream filein; void main() { char file[20]; //you must type in filename and extension … | |
Hi everyone, I am still having a few issues with my program. It definitely runs but it just seems to run poorly. I think my problem lies within the following 3 sections Quicksort, Partition, and Insertion I've written comments next to each line of code just to make sure that … | |
[code]//final.cpp //Creates an array with 2 players' batting avg //Read in hits and atbats for each player //1) one player get data in main //2) other get data in battingavg function //battingavg function figures out battingavg for both players // and puts them in array (not hits & abats), print … | |
Hello everyone, my code is finally complete thanks to all of your help. One questions I have is regarding the reslts. I thought that Merge was faster than a heap sort. In my results however (when run on Borland c++) Heap comes out with a faster sorting time. The functions … | |
When this program runs, I can enter in the name the first time through the while loop (using "cin.getline). When I go through the second time, it skips the name and asks to enter the ss#. The first time through, everything works fine. [code] #include <iomanip> #include <iostream> #include <fstream> … | |
HI I am trying to write and read to file. I am experimenting with a small piece of code before going onto my main program. I am simply trying to write a float variable and a String variable to file using fstream. The variables are float version; Edit1->Text (this is … | |
Can anyone tell me why this is printing doubles out to the output file? [CODE] IndexFile.seekp(20, ios::beg); for (i = 0; i < NumOfSlots; i++) { if (RandomFile.peek() == 42) { Position = i; RandomFile.seekg(37, ios::cur); //cout << Position << " "; } else if (RandomFile.peek() != 42) { RandomFile.get(R.SSN, … | |
I write the folowing code which is taking RAM and Hard disk capacity from user by using structures and than saving it to a new file after the user complete entring data it is displaying data entered by the user by opening that file. Problm is that i want to … | |
Hello again everyone. We have completed a project after a few months and a lot of help but for some reason we are still having problems. The project compiles properly without errors but the results are incorrect. Basically we are using 4 sorting algorithms in order to calculate how much … | |
Hi Guys, Kindly help me Solve this. I have already worked on the classes that were inherited and attached after the question is the main part of my program. I have bolded the part in the question below where I need help. Thank you so much. The question is: Make … | |
Can anyone help me with this snippet of code? I have 2 files, a random record containing random records in it and an index file, which contains the binary tree of the random record. Here is what the index file looks like: 123456720 4 -1 -1 123456708 6 -1 -1 … | |
Can someone help me to make my program sort according to the average gallons used per car I keep geting 30 - 40 error when i try to compile it. Also my files do exist. [CODE]#include <fstream> #include <iostream> #include <iomanip> using namespace std; const int MAXCARS = 12; float … | |
I have this code that I started on but cant seem to finish it. i have to create an file and put the outcomes in it. I cant seem to figure it out. can soemone please help. thanks, john [code] #include <iostream> #include <fstream> #include <cstdlib> #include <ctime> using std::cout; … | |
Can someone help me to figure his out. I have to read in a file that contains employee names, numbers, payrates, and hours. Then I have to calculate the gross andsend everything to an output file. I keep getting this error message "employee.cpp" 69 lines, 1471 characters $ c++ employee.cpp … | |
This is a short list of recommendations on how to use C++. My experiences are from using gcc 2.8.0 and Visual C++ 6.0. I had to have things compatible between these two compilers, and between Unix and Windows. [b]Contents[/b] [color=#800080]IO of binary files[/color] [color=#800080]When are destructors called for local variables[/color] … | |
This is my very first introduction to C++ and I am stuck with a very simple mini-calculator project. I cannot figure out what the errors are that the compiler is showing. I have shown my written code and the compiler messages below that. I am receiving syntax errors on the … | |
whenever i use cin.get in a loop it skips over the first cin.get. for example, in the code below, the programs skips over the cin.get for the stu.name?? [code]#include<iostream.h> #include<fstream.h> struct student { char name[20]; char ssn[20]; char dob[20]; float gpa; }; main() { student stu; ofstream outfile; char choice; … | |
This is my first attempt at creating a program and I am having great problems. The program is meant to scan a file and increment a counter if specific words are found. Can anyone let me know where I'm going wrong,Thanks #include <iostream> #include <fstream> #include <string> #include <iomanip> #include … | |
Okay, I need to read in a binary file from stdin and stick it in an array. The file contains binary representations of floating point numbers. I need to make sure that my array is sized properly based on the number of elements. It is quite easy to do with … | |
ok, help!!! I'm totally lost. I have to use a file stream program and add names to file, then keep count of file names, then display the count of names entered and the names entered. Use a loop to enter names until prompt to end. these are just two of … | |
#include <iostream> #include <string> #include <fstream> using namespace std; void main() { ifstream indata; ofstream outdata; char name [13][20]; float avg[20]; int sum=0, n, i=0, m,p; float davg; char ch; indata.open("a:nameFile.txt"); if(indata.fail()) { cout<<"file not open:"; exit (1); } while(i<=20) { for (i=0;i<20;i++) indata.getline(name[i],20); } for (int k=1; k<=3; k++) … | |
![]() | I've been playing around with files and streams and just hit a pot hole. My goal is to be able to input time and date into a file when say someone "clocks in/out". Just a little program that will help me keep up with my time in school. [CODE] #include … ![]() |
I have this banking program that has a savings, checking account set up. The user has 4 options. Checking, Saving, Balance, and monthly maintenance. The checking option is all correct and never comes out weird...u can deposit everything and withdraw without any probs. If i do that -- then i … | |
This is the code that is suppose to compute the class's average and standard diviation from a file which contains a collection of student ids and corresponding scores from my computer class and assign each student a letter grade. the class can have no less than 7 students and no … | |
I have to write a program to compute the class's average and standard deviation from a file which contains a collection of student idds and corresponding scores for my computer class. I am to assign each stedent a letter grade as follows: 100-90 = A 89-80 = B 79-70 = … | |
error reads: body has already been defined for function 'main()' program is as follows: search.h file [code]// display files in a directory #include <stdlib.h> #include <dir.h> #include <dos.h> #include <string.h> #include <iostream.h> #include <fstream.h> ofstream outfile("output.dat",ios::out); class dispfiles { public: int showfiles(void); char allfiles[MAXPATH]; private: char *getdirectory(char *path); char curdir[MAXPATH],temp[3]; … | |
Hi I have been given a assignment of making a "inventory control program of a book store in c++" i have done all the parts except for two 1. I have to delete a record from the file (i am using fstream and saving the file i need the piece … | |
I couldn't get in here for a while, my pc was clocking-busy place?! I posted my problem to the wrong forum & didn't get any help-surprise! I just want to know what I'm doing wrong in my code. I can't get rid of the 2 errors or understand what they … | |
> oh yeah. well it happens sometimes Hi, Can anyone give me a hint of what I'm doing wrong here? not pretty, but here's my code... #include <iostream.h> #include "apstring.h" #include <fstream.h> int main() { apstring user_name; int street_num; apstring street_name; apstring apt_num; apstring city; apstring state; int zip; ofstream … | |
I receive to build areas when I want to start my debugging. But the errors do not show up when i just compile. They are: error LNK2001: unresolved external symbol "void __cdecl withdraw(char,double &,double &,class std::basic_ifstream<char,struct std::char_traits<char> > &,struct node * &)" (?withdraw@@$$FYAXDAAN0AAV?$basic_ifstream@DU?$char_traits@D@std@@@std@@AAPAUnode@@@Z) and fatal error LNK1120: 1 unresolved externals. … | |
I AM RUNNING A PROGRAM THAT DEALS WITH TEXT FILES IN NOTEPAD. I TYPE IN A FAKE SSN AND THE PROGRAM IS TO READ A LIST OF FILES FROM student course. I AM GETTING AN ERROR MESSAGE TELLING ME THAT PROGRAM CAN'T READ FILE. TWO EX OF SSN'S ARE 201235678 … | |
Is reading and writing strings inside of structures possible, or must you use character arrays? Here's what I've tried; no compiler errors, but it doesn't display the text: [CODE]struct Account{ float balance; string Owner; }; int main(int argc, char *argv[]) { fstream File; Account Acc; int row; cout<<"Open or New? … | |
Hello, This is my first post. Anyway.. I am having trouble with my c++ program. My assignment is to read from a file a 2-Dimensional array. However, when attempting to do so with my code, which i'm guessing is faulty, I keep getting this error while using Borland Turbo C++ … | |
This program is a word counter. But my logic is all messed up when it comes to the counting. I am not too sure on how about fixing it. The project compiles yet does not work properly. I still haven't figured yet how to count lines or characters properly. [code] … | |
I am a java programmer trying to understand a c++ oddity that I ran into. My c++ program writes a few MB of data using ofstream. Just before the program ends I close the ofstream. However when the program terminates, the amount of free memory on my linux box has … | |
I just can't figure out why this program isn't reading in the entire file. It will only read in the second line, nothing else. Here are my read and write functions: bool Write(string Text,string FileName){ fstream Write; Write.open(FileName.c_str(),ios::out|ios::app); if(!Write){ cout<<"Error in opening file"; return 0; } Write<<Text; Write.close(); return 1; … | |
hello there..! can somebody help me how to call this function...the program function will appear when i select the case no 3 at swich code... however there is an error appear...bytheway is it correct i using ` "void loan_schedule ();"`..to Generate loan payment schedule coding...when i choose number 3 at … | |
I'm trying to complete the following problem: write a problem that generates a table showing tuition and fee costs. the table continues to print up to and including a maximum number of credits that has been input by the user. The program should check that this value is between 12 … | |
[CODE] //Program to collect and hold data on CD's #include <iostream> #include <fstream> using std::cout; using std::cin; using std::endl; using std::ifstream; int main() { int QA; cout << "To veiw file press v, to add a new CD press a:\n"; cin.get(QA); if (QA == v) { while (CDs.get(ch)) cout.put(ch); } … | |
This is my project: Read the data one line at a time and store them in two different arrays. Pass the first array to a function that sorts the array in ascending order using selection sort. Pass the second array to a function that sorts the array in descending order … | |
hai can anyone please help me find the error in my program? when i try to compile it says case bypasses initialisation of local variable. i can't figure out the mistake. i am sitting with this for a week. i will be thankful if someone could help me figure it … | |
[code] #include <iostream.h> #include <string.h> #include <stdlib.h> #include <iomanip.h> class hope { char st_title[25]; char st_website[35]; char st_star[25]; char st_maker[25]; char st_rating[5]; int i_minutes; int i_year; float f_cost; int i_age; char st_status[6]; char st_response[20]; char ch_option; void getdata(); void processdata(); void putdata(); public: void run(); }dvd; void main() { char … |
The End.