2,025 Topics
![]() | |
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 … | |
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 … | |
[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 << "------------------------------------------------------------------------------------------" << … | |
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. … | |
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() { … | |
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; … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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> … | |
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... … | |
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 … | |
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, … | |
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] … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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; … | |
[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 … | |
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], … | |
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> … | |
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 … | |
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 … | |
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 … | |
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; … | |
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& … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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, … | |
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] … | |
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 … | |
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) << … | |
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; … | |
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 … | |
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 … |
The End.