2,025 Topics
![]() | |
Hi all, I have a problem reading data from my file for example this is my textfile CODE MARKER //Names of columns in my table PKY KELLYS ELM ELMANS OOC OLIVER QRT QUATAR A user is asked for code, when the code is entered, the corresponding name is displayed eg … | |
Here is my code, the aim is to use dynamic memory and pointers. The program siccesfuly reads in data from a text file into the dynamic array(matrix). The size of the array is also in the text file, so thats how the size of the array is known. I am … | |
I am currently using Kubuntu 8.04. Although I do not know any bash, I altered the bash shell (via internet guides) to append history instead of truncating the history file. After editing the shell, the default way to clear the history only clears the interactive history and not the actual … | |
i'm trying to write a program that reads a text from the user(keyboard) sentence by sentence and then prints the 'morse code' of them char bay char on a text file. I'm just testing it for the letter 'c' to start with, but it doesn't seem to be working well … | |
[code=cplusplus] int Seats::AddEntry() { std::cout << "Please enter your desired seat position"; std::cout << endl; std::cin >> position; ofstream SaveFile("Traveler.txt",ios::in); SaveFile << "Your Seat postion is...:"; SaveFile << endl; SaveFile >> position; SaveFile.close(); return 0; } [/code] This is just a snippit of my code...This function is one of 3 … | |
i have text file with a series of words in it. some word contain the expression '.zip' , i'm trying to rerad the characters of the file and replace the .'zip' with '.rar' this is my prog, bu it's not responding [code=cplusplus] #include <iostream.h> #include <fstream.h> #include<stdlib.h> #include<conio.h> void main() … | |
i'm trying to write a program that reads a text from the user(keyboard) sentence by sentence and then prints the 'morse code' of them char bay char on a text file. I'm just testing it for the letter 'c' to start with, but it doesn't seem to be working well … | |
Hi All, The CPU Utilization in my program is too high when I am trying to read a file. Can you please suggest a better method. Please find code snippet that I am using. [code=cplusplus] void SyslogReader::isTrapRaisedFromTestClient(list<SNMPTrapInfo>* pListSNMPTrapInfo, const int nSemID) { int nWaitCount = 0; const int SYSLOG_MAX_MSG_LEN = … | |
[B]Game I am about to make:[/B] Coins are randomly drawn from a set of possible coins and arranged in a line. Two players alternately remove and collect a coin from either end of the line. The game ends when all the coins are removed and collected by the two players. … | |
Hey, everyone, I am another student seeking help for a programming class. What I am having trouble with specifically is reading from a file. The program itself involves entering in some store products with information such as: product name, product ID, etc. After everything is entered, the program is supposed … | |
I am working on a program with function files and I am not sure how to ask this so this might be kind of interesting. We were given an input file that I saved to my desktop. This is all I did with it and I am not sure if … | |
please help to with this program by mainly using arrays and pointers ,... i need this program to check 2 matrix files "if they contain any character and if they contain cout<<"invalid"; " and to open them from .txt file Help with Code Tags cplusplus Syntax (Toggle Plain Text) [code] … | |
I wrote a program to calculate a loan, the program compiles and works fine, but I get an answer I do not understand. The answer comes out "$1.#J". I am pasting the code here I am using, I am not worried about the code it is a pretty simple set-up … | |
[B]Game I am about to make:[/B] Coins are randomly drawn from a set of possible coins and arranged in a line. Two players alternately remove and collect a coin from either end of the line. The game ends when all the coins are removed and collected by the two players. … | |
Assignment - [url]http://condor.depaul.edu/~ntomuro/courses/262/assign/hw2.html[/url] [code]Write a class called Loan, which simulates the money you borrow from a financial institution, and a main function (i.e., an application program) which tests the class. You write ONE file, which should be named "myLoan.cpp". 1. Class Loan The class Loan should have the following members: … | |
I am trying to solve a problem from a lab challenge. I can not get the program to compile correctly. Please look over and let me know where I need to be looking to solve this Use a two-dimensional array to solve the following problem. A company has four salespeople … | |
I have to program an Address book program in C++. So far I've done about 40% of the assignment. The main requirements of the Address Book are the following (Which I am confused about are): 1. Display 20 Contacts at a time, using the space bar to go to the … | |
please help to with this program by mainly using arrays and pointers ,... i need this program to check 2 matrix files "if they contain any character and if they contain cout<<"invalid"; " and to open them from .txt file [code=cplusplus] #include<iostream> #include<fstream> #include<string> #include<cmath> using namespace std; int main() … | |
hey again, code below works but it tends to give some info which shouldn't be there: (for example a - 0 where 'a' is a letter and 0 is the times the letter was repeated) [code=cplusplus] #include <iostream> #include <stack> #include <fstream> using namespace std; int main() { fstream fin1("E:\\iras.txt", … | |
I am currently working on a mini project for my class. the project is designing a game called etch n sketch. you first etch out a map then quit the game after youre done. then sketch the etch you just created. the problem im having is the scoring system. score … | |
I'm having problem with this code. Here's what I'm trying to do. I want the user to enter the firstname, last name of the person whom he wants to delete from the phonebook. then I try to compare the data entered by user with the names already stored on phonebook. … | |
Hi, I want to be able to use std stream objects to manipulate files, but some of the files are too big. I want to be able to do the folowing: >int64_t fileSize; >strm.seekg(0,ios::end); >fileSize = static_cast<int64_t>(strm.tellg()); >cout<<"File size is "<<fileSize; This code will output -1 if the size of … | |
why cant it work properly??? [CODE]#include <iostream> #include <fstream> #include <string> using namespace std; int main(){ ofstream out;//create output stream int acc_num[10]; for(int x=0;x<10;x++) acc_num[x] = rand()%10; //generate account number char acc_file[600]; for(int x=0;x<10;x++) acc_file[x] = acc_num[x] + '0'; out.open(acc_file, ios::out);//create & open output file out << "PACKAGE ID: "; … | |
Hello I'm a newbie at c++ and I'm doing a basic course in school at the moment. I have an assigment which unfortunately is impossible to complete with my knowledge (that is how it feels like at the moment anyway :'( ) . I'm not looking for someone to do … | |
im building a telephone directory. and the code is given below. i am using file system to store the record which i get from the user. and then i should be able to do searching, deleting, sorting and other default telephone dir functions. so far i have been able to … | |
Hi i have been making two programs: one that sends a file's filebuf made into a char*, and another that receives that and writes it to a file. They're like exe sending programs. I can send the char* and write it onto the console using cout.write(), but when I try … | |
Hi, I made a simple program that copies files. I tried to copy an exe file, but after I tried to run the copied version, it doesn't work properly. Please help:?: Here's the code for the test file to copy: [code=C++] #include <iostream> int main() { std::cout << "Hello!"; std::cin.get(); … | |
i'm looking to get a first name followed by four scores and finally a last name, stored into multiple arrays (a char *array, a float array, & a char *array). getting the scores i understand however the names are pointer arrays. as far that goes what am i doing wrong … | |
I am new to streams and files in C++. I am having a problem in this code. When i run the program, and after entering the password, a message is displayed "error opening infile". Why the program is not reading from the file or opening it? [CODE]#include<iostream> #include<string> #include<fstream> #include<iomanip> … | |
hi all guru, here, my problem is re-running the program, the vector attribute of Service Class was listed unreadable characters.. WHY?? Below is my following code : Service.h code: [code] class Service{ protected: char servType[100]; vector<Medicine> vecMedicine; // the purpose that i created a vector attribute is a service can … | |
Hi, everybody. This is my first day here. And I create a new account because I hope to learn more from you. Here is the my task. I have a text file, it contains a DNA sequence. I want to fragment it into sequences with a definitive length into a … | |
i compile this code in Microsoft visual studio C++. No errors.. but i cant save the file.. why ?? [CODE] #include <iostream> #include <vector> #include <fstream> #include <conio.h> using namespace std; using std::vector; class Service { public: Service( string d ) { strcpy(servDate,d.c_str()); } void setDate(string d) { strcpy(servDate,d.c_str()); } … | |
#include<iostream> #include<fstream> #include<iomanip> using namespace std; class lohi { int x; int y; public : lohi() { x=10; y=20; } }X; int main() { fstream io; io.open("just1",ios::in | ios:: out | ios::app); io.write((char*)&X,sizeof(X)); io.close(); } in this programme i expect a file to be created and contents of x,y to … | |
I need help storing data in archives, I always get an unhandled exception when i try... [code=c++] #include"Inventory.h" #include"CustomerTransaction.h" #include <fstream> using namespace std; CarInventory* car_list; int main() { SLL<Customer>* customer_list = new SLL<Customer>; car_list = new CarInventory(); fstream file; file.open("Models.txt", ios::in); if (file.fail()) { cout << "\nFailed to open … | |
Hi guys! I have started writing a program for phonebook which will add, delete, search, display and sort the information of a person. information will include firstname, lastname & phonenumber. now I was testing the first part of the program which adds a contact. but my loop is not doing … | |
Hi i have my code that finds every instance of my search criteria in a text file and tells me the position in the text file it is located at. The next step i want to do is stream the bytes that follow each instance of my search criteria into … | |
Hello, I am having a problem to call a function I am posting the code... Can anyone help how we can solve the problem... [CODE]int AES(string path1, string path2) { ifstream myfile1 (path1, ios::binary);// error ofstream myfile3 (path2, ios::binary);//error } int main() { AES( "c:/plaintext.txt" , "c:/cipheretxt.txt" ); return 0; … | |
How would I display an IP address from /var/log/wtmp? I know I could use utmpdump, but that's not what I'm going for. I have included bits/utmp.h and can display other members of the struct, but when i try to display the ut_addr_v6 member, I get a random hex address instead. … | |
I'm a student enrolled in a University beginners programming course. The problem is: [B]Write a program capable of using month and day of a given date to calculate the number of days from january 1 that it represents. Make the program capable of computing values for as many as 20 … | |
I HAVE AN ASSIGNEMENT IN WHICH I GET STUDENT DATA AND SAVE IT A SEPARATE TEXT FILE , THE MAIN PROBLEM IS THAT IT TAKE ALL THE VALUES BUT DONOT STORE VALUE OF SEM,ADD-NO AND BATCH . KINDLY PLEASE HELP ME . Coding is :- [code=cpp]#include<iostream.h> #include<conio.h> #include<fstream.h> struct stud … | |
For some reason when I compile my code the hypotenuse returns to just 0 and it returns an integer and not a double and was wanting to know if anyone had any suggestions........ [code=c++] #include <iostream> #include <cmath> using namespace std; double Calculate_Hypotenuse(int length_one, int length_two); int main() { int … | |
I'm trying to create a parking lot system where users can enter and exit a lot. This lot should be kept on a file(s). My code compiles but my data doesn't write to the actual file. [CODE]void SYSTEM::parkProcess() { CARD IDcard; char lot; int id; string type; cout<<"Enter Parking Lot: … | |
i'm working on a banking system.....m stuck here....i dont know how to do this: 1.Their account should already have an amount of money for further processing. 2.All users are able to perform transactions such as withdrawal, deposit and check balance etc. 3.Each user will have a file or record to … | |
why cant i type in my address??? [CODE]#include <iostream> #include <fstream> #include <string> using namespace std; const int maxstring = 120; typedef char stringtype[maxstring]; void newuser(){ system ("cls"); stringtype name; string type, id, cnumber, address; double amount; ofstream out; cout << "ENTER YOUR NAME: "; cin >> name; out.open(name, ios::out); … | |
Im trying to read lines in from a txt file to write into another txt file but at the moment its only reading the first line. I need it to read 1 line at a time and store it to add to another txt file before reading the next line. … | |
I have been doing c++ for somewhere between 1 1/2 and 3 months (I'm awful keeping up with time). I have a program (one of my first) that I have taken and added pieces to since I made it and it has come to be the piece of work it … | |
Here's this program i write to uppercase proper nouns in a file. It opens three files: 1. is the file to uppercase. 2. is a list of proper nouns to uppercase. 3. is a list for proper nouns preceeding words that excludes proper nouns to be uppercased. I rechecked it … | |
I suck at C++! like really badly, i just cant grasp it, and now i have to write a program for it that is suppose to input some values from a text file that would create like a gradebook thing. im also supposta use a void function, calculatedAverage to determine … | |
I am a new student of c++ and am having a hard time with a program. i have never used filestreams before and been getting an error from the compiler that i do not understand. it reads ['struct std :: string' has no member named 'c-string'] i dont know if … | |
What is wrong with this function? [code]// /////// // void GetData(int(IDs)[], float(Scores)[][4], int &i) { //GIVEN: One blank ARRAY, one blank 2D ARRAY, & a index variable. //TASK: Function retrieves data from open stream into multiple functions. Stores ID into one structure and all of the student's test grades into … |
The End.