2,025 Topics

Member Avatar for
Member Avatar for trcartmill

I need to string names from a text file which the name will output no more than 29 characters and no commas. My output displays no commas, but i cant figure out how to count the characters and output no more than 29 characters in the name. I think I …

Member Avatar for Lerner
0
135
Member Avatar for exospire

This is a school assignment and I think it's nearly done, there are probably some parts that need straightening out, but at this point I'm just trying to get my program to compile correctly. The program depends on an input file with sample data as follows: 1000 John 9.5 9.0 …

Member Avatar for super-sonic
0
358
Member Avatar for alflash

[CODE] fstream* file = new fstream("GameDetails.txt", fstream::out); ofstream out; out.open("GameDetails.txt",ios::ate); while ( more ) { game.Tic_Tac_Toe_Board(); player = game.Pick_Player(); fstream* file = new fstream("GameDetails", fstream::in); *file << left << setw(30) << setw(25) << "Player" << setw(25) << "Wins" << setw(10) << right << "LOSES" << endl; *file << "------------------------------------------------------------------------------------------" << …

Member Avatar for jonsca
0
73
Member Avatar for DCV

Hey, I'm in a class in which the assignment here is to sort integers. We were called on to use two different sorting methods: InsertSort and HeapSort. My InsertSort works just fine. My HeapSort, however, does not; when the HeapSort() function is finished, the integers are still out of order. …

Member Avatar for Narue
0
136
Member Avatar for kako13

Hi, I want to edit a record inside a txt file. So first a search for the record inside the file and display the record to the user. But for example, if the user want to edit the name, how I can go to that position? [CODE] void editar_cliente() { …

Member Avatar for Lerner
0
230
Member Avatar for mloC

This Program is supposed to get a filename, title and description of a database and then store it to and appropriate filename. [CODE] #include <fstream> #include <iostream> #include <cstdlib> #include <string.h> #include<ctime> #define MAX_FILENAME 256 #define MAX_INIT_NAME 1024 #define MAX_DESC 1024 using namespace std; class date { public: int DAY; …

Member Avatar for mloC
1
96
Member Avatar for stevechow

My program takes numbers from a .txt file then puts it in, so that an array has a "bacteria" in it. The "bacteria" will die if it has 4 or more, or if it has 1 or less. It will live with 2-3 neighbors. If an empty cell has three …

Member Avatar for Nick Evan
0
109
Member Avatar for sperrytx

I am a beginning c++ student and need to read in a text file as shown below: [code=text] Orvilles's Acres, 114.8 43801 Hoffman's Hills, 77.2 36229 Jiffy Quick Farm, 89.4 24812 Houston Bayou Texas Home Grown Popcorn Inc., 124.7 65687 [/code] The criteria is to read characters to comma then …

Member Avatar for Clinton Portis
0
292
Member Avatar for UberJoker

Any ideas on how would I be able to traverse this BTree in asceding order? right now I am sorting the data and giving it to my retreival() function to look for the keys. But naturally it visits and prints the data in ascending order because I give it sorted …

Member Avatar for wmsigler
0
232
Member Avatar for greko2009

Hello, I have a binary file of this format: 1st 2 bytes = total number of entries (This appears only once at the file beginning) Then each record is of the following format: 2 Bytes = Entry no. 2 Bytes = Entry category 2 Bytes = Description length n Bytes …

Member Avatar for greko2009
1
320
Member Avatar for K!nKy

Hey everyone, so I am having a really annoying problem with my code. The goal of it is to be able to read a text file of an unknown length (it's more or less a class roster w/ scores) and calculate and display the average of each student. The code …

Member Avatar for K!nKy
0
968
Member Avatar for shmeeps

Basic, I'm trying to read in a file that has lines of data, where each set is on a new line, and each variable is separated by whitespace, save for the name, which can have multiple white spaces. Here's basically my code, the parts that matter. [code] #include <stdio.h> #include …

Member Avatar for shmeeps
1
186
Member Avatar for gsingh2011

I need to save an object to a file and then reload it later on. I think this is called serialization but I don't know. I have made a simple example below that I need to fix. [CODE]#include <iostream> #include <fstream> #include <windows.h> using namespace std; #define MAXV 1000 class …

Member Avatar for Ancient Dragon
0
116
Member Avatar for rsaska

I am trying to write a program that 1. opens letterFile containing letters on each line 2. reads in first line of letterFile 3. save the pointer position of letterFile in pos 4. opens numFile containing numbers on each line 5. as it goes through numFile, outputs the letter from …

0
69
Member Avatar for samarth

Hi, I have the following piece of code. I do the following here 1)open a file. 2) Print the filepointer positon . I get 0 3)Read the file in a while loop till i reach the end 4)close the file 5)Open the same file 6) Print the file pointer position …

Member Avatar for gastonci
0
272
Member Avatar for react05

Hey guys, how would i convert the code in option ascending and descendingGPA to where it sorts all students in ascending order by lastname and all students in descending order by gpa. thanks! [code] #include <iomanip> #include <iostream> #include <fstream> #include <cstring> using namespace std; struct StudentRecord { char lastName …

Member Avatar for Ancient Dragon
0
107
Member Avatar for Bladtman242

Hi, i just don't get why this isn't working. It is supposed to read from the end of a .txt and up, until it hits the first space but it just keeps repeating the last character in the text file ip.txt Any help is much appreciated. [code=c++]#include <iostream> #include <fstream> …

Member Avatar for Bladtman242
0
630
Member Avatar for Clinton Portis

Unfortunately in c++, there is really no good way go locate lines in your file without reading the entire file 'character at a time.' So, if you [I]have[/I] to read only a single line from a file, we know we are at some point going to have to be inefficient... …

Member Avatar for Clinton Portis
2
2K
Member Avatar for muffinhead

I'm writing a program that is supposed to be able to bubble sort data by name and by average. The data I'm given is student last name followed by 3 scores, all put into a text document. I'm to read the names and scores into their respective parallel arrays, and …

Member Avatar for Ancient Dragon
2
121
Member Avatar for LisaJane

I have this program that is supposed to read part numbers from a text file. 101-110, 301-310, 501-510 and put them into a hash table. It will prompt for one of four algorithms to be used and then continue to load the part numbers. Everything seems to be working okay, …

Member Avatar for xaveri
0
5K
Member Avatar for mksakeesh

Hi, I have an text file "CD details" with content as below 1~ Cast Away~ English~ Thriller~ U~ 2~ Titanic~ English~ Romance~ A~ 3~ Forest Gump~ English~ Life~ U~ I am trying to add some additional data to the start of each line by using a code as below [code] …

Member Avatar for mksakeesh
0
101
Member Avatar for cnote1287

I have a file of data that was put into a data file by another program with the same struct. for this program i want to take that data out of the .txt file and put it back into the struct array. is there any big code that is wrong …

Member Avatar for cnote1287
0
118
Member Avatar for abbz375

Hi everyone, I'm new to this forum and it has helped me a lot with the project I am currently working on. Using VS2008 and created an MFC dialog based application. I just started learning C++ and am finding it difficult to solve this problem. What I'm trying to do …

Member Avatar for abbz375
0
2K
Member Avatar for Clinton Portis

A lot of people have questions about how to load a text file using file I/O. There seems to be 2 popular methods to loading a text file: Use fstream's >> extraction operator. Simple enough, load the file directly into individual containers, word at a time, but you lose your …

Member Avatar for mrnutty
1
195
Member Avatar for kryz

I'm confused with pointers. I'm not sure how to get the vowels to show up in Case A. Also, I would need help by how to get the program to run again after case A instead of ending the program after each case. Should it be in if/else statement instead …

Member Avatar for Clinton Portis
0
789
Member Avatar for Jalwes

Hi all, I'm having a heck of a time with our latest assignment. I've tried everything I can possibly think if to make this work, but with no luck. We need to Load an inventory text file, sort it, search it(haven't even got to that portion of the code). I …

Member Avatar for Tales
0
142
Member Avatar for Flybro

Hi guys, I'm trying to write a small program which will search a file for few bytes and replace it with another bunch of bytes. But everytime I try running this small app I got message about [B][I]istream_iterator is not dereferenceable[/I][/B]. I'm even not sure that I know how exactly …

Member Avatar for quetzalcoatl.pl
0
81
Member Avatar for davzi

Hi I was wondering if you could help me with a question on image processing. I am using c++to process the image.I have a raw file, and I have read it by creating an fstream, and have saved the length of the file in variable end. [CODE] #include <iostream> #include …

Member Avatar for davzi
0
2K
Member Avatar for bpt0004

Hi there daniweb, i'm making a program that deals with a hill climber and genetic algorithm. I'm pretty much done writing the code but i'm having a headache of a problem....heres the header[CODE]#include <iostream> using namespace std; template<class T> class myVector { public: myVector(); int get_size() const; int get_capacity() const; …

Member Avatar for bpt0004
0
99
Member Avatar for amer_milo

[code] //Student Name: Mohamad Amiruddin & Frank Douglas //Course: Diploma in Information Technology //Group: IT3 //Student ID: 0165-DDC-08 & 0684-DDC-08 //Program Name: Student Grade Report //Assignment Number: 1 //Assignment Name: Assignment 1 (Mini Project) #include <iostream> #include <fstream> #include <iomanip> #include <string> using namespace std; //Content Declaration void reportHeader_weigtage (string …

0
282
Member Avatar for dmitriylm

Hey guys (and girls), I'm trying to write a program that will read a simple text file and output a file with the same contents with the addition of line numbers. This is what I have so far: [code] #include<iostream> #include<iomanip> #include<fstream> using namespace std; int main() { char filename1[20],filename2[20], …

Member Avatar for vmanes
1
103
Member Avatar for bpt0004

I'm trying to run my program but i can't find out why its giving me a segmentation fault. Please Help. [CODE]#include <cmath> #include <cstdlib> #include <ctime> #include <string.h> #include <fstream> #include <sstream> #include <stdexcept> #include <stdio.h> #include <ctype.h> #include <vector> #include <cctype> #include <algorithm> #include <iterator> #include <iomanip> #include <cstdlib> …

Member Avatar for donaldw
0
138
Member Avatar for Ryujin89

I have, with the vast assistance of Bazzy on cplusplus as well as a few other programmers, made the code to input a file into a vector. Even after looking over the tutorials on algorithms, I still can't figure out how to sort the data. It's due in [U]4 hours …

0
79
Member Avatar for valkerye

I'm having a lot of issues with a program I'm working on and I really use any suggestions I could get. The purpose of the program is to take an input file that has a users name, the number of minutes in their call plan, and the number of minutes …

Member Avatar for vmanes
0
165
Member Avatar for valkerye

I'm having an issue with an end of file while loop. I have narrowed a problem with a previous program into a smaller bit of code and the error is in the read in and i hove no idea what to do about it... I have done this kind of …

Member Avatar for Ancient Dragon
0
199
Member Avatar for ellimist14

I know it's a lot of code but any help anyone can give would be amazing. Basically when I re-write out to the binary file it must not be working because when I try to print it it only prints the record I updated. [code] void updateRecord() { int key; …

Member Avatar for rdrast
0
164
Member Avatar for newcpp

I have a problem when handling the txt file in C++. My code is like this, and the test.txt file is in the attachment. there are two functions: [LIST=1] [*]int txtnum(ifstream& input, char* filename ) is to count the amount of numbers list in the txt file. [*]long filesize( ifstream& …

Member Avatar for Ancient Dragon
0
139
Member Avatar for Ryujin89

Figure I might as well go ahead and clear up that this is obviously a school assignment. I have completed a somewhat decent amount of code (not saying I have a lot of faith in it's correctness tho) and need assistance to figure the rest out. I'm at a complete …

Member Avatar for Ryujin89
1
196
Member Avatar for yatman

Hi, I am trying to write strings to a file line by line and trying to format the output so that the alignment is proper. output should be it should appear in the output file as david 10 15 16 sam 11 15 16 but appears as david 10 15 …

Member Avatar for yatman
0
171
Member Avatar for Gem74

Hi, I am trying to build a linked list, I have the following, and I get 4 error messages, ListNode, NumberList, and head undeclared, and then syntax error, please help. #include <iostream> #include <fstream> #include <ctime> #include <string> #include <cstdlib> //#include "input_data.h" using namespace std; class Node { public: int …

Member Avatar for jonsca
0
151
Member Avatar for ninreznorgirl2

I've worked with making classes, but I've never had to use a class in code that I write, so I'm having a hard time. [CODE]#include <iostream> #include <string.h> #include <iomanip> #include <ctype.h> #include "String2.cpp" using namespace std; const int MAX_WORD_LENGTH = 254; // The type definition below permits much easier …

Member Avatar for u8sand
0
209
Member Avatar for just4why

I would like to automatically generated staff number before generated the staff number i would like to check the staff.txt is the staff number exist. If exist then it will get the last's staff number and continue to adding. But the code that i creating it wont work. Please help …

Member Avatar for just4why
0
112
Member Avatar for GPXtC02

i'll start typing a command in the telnet module to communicate with my telnet server after i've already been connected and the server will suddenly drop me, exit telnet, and bring up the cmd prompt. what in this code is doing this? [code]void do_handleclient(int connsock,struct sockaddr_in *client_addr) { // Communicating …

Member Avatar for GPXtC02
0
106
Member Avatar for abhaymv

I am a student in C++.We undertook a school project to develop a library information system.We are only allowed to use Turbo C++ version 3 compiler.We cannot use ANSI/ISO C++(Not in our syllabus.)The following is my problem: In my project, I have a class books.When the program is first run, …

Member Avatar for abhaymv
0
193
Member Avatar for pac-man

Hi there, I am relatively new to C++ and was hoping someone could provide me with some guidance, I have a .txt file that contains a heap of HTML and I wish to extract a small portion of [B]dynamic[/B] text from differing places. For example: [U] .txt file before filter[/U] …

Member Avatar for pac-man
0
152
Member Avatar for mehmood_ahmed

hi ... i am making a program which can handle bank acount system. In which User can MakeDeposite,WithDraw money and CheckRemainingBalance. when user MakeDeposite then a certain amount should be saved and as how much times user MakeDeposit, it should be added in balance amount and as how many times …

Member Avatar for mehmood_ahmed
0
80
Member Avatar for restrictment

Hey, I am just learning functions. I was wondering if you could tell me why this piece of code is not implementing the 'values' function. [code] #include <iostream> #include <windows.h> #include <string> #include <iomanip> void values(float value1[11]); using namespace std; float value1[11], value2[11]; int main() { cout << setiosflags(ios::fixed) << …

Member Avatar for restrictment
0
126
Member Avatar for restrictment

Just testing out arrays on this one. MY project is to create a thermometer that converts Celsius to Fahrenheit or vice-versa. [code] #include <iostream> #include <windows.h> #include <string> #include <iomanip> using namespace std; int main() { cout << setiosflags(ios::fixed) << setprecision(2) << ios::showpoint; float value1[11], value2[11]; char gauge1, gauge2, gauge; …

Member Avatar for restrictment
0
212
Member Avatar for karthik.c

hi guys im tryin to do a java client / c++ server socket program .in the java client program i serialize the object and pass them over socket to c++ server.now when im gettin them in c++,im not able to deserialize it properly as i tried for binary serialization since …

Member Avatar for ejosiah
0
603
Member Avatar for chubzyko

Hello guys! can you give me an example on how to switch lines or records inside a textfile? I need to enter 2 numbers, there are 3 numbers inside the textfile, which also means it has 3 lines. [QUOTE]1 name 2 name 3 name [/QUOTE] 1st number entered= 2 2nd …

Member Avatar for chubzyko
0
190

The End.