2,025 Topics
![]() | |
Please help, I can compile this program as long as I don't put in a wrong number. The numbers are supposed to be between 100-999. If I type in anything else, it lets me input the information but I can't access anything after that. Ex: i type in info for … | |
So below is a working program I wrote that mimics a rolodex. It stores the information on a text file with the number of cards listed at the top of the file and one card per line like this: last first phone email last first phone email ... I'm currently … | |
I'm wiring a program where I have a file with city, state, population size laid out as follows; 24 El Paso, TX 577415 Indianapolis, IN 783612 Detroit, MI 925051 Fort Worth, TX 567516 Los Angeles, CA 3798981 Washington, DC 570898 etc... with 24 being the number of elements in the … | |
I am new with vb can anybody help me with port ios how to manage the ports | |
#include<string> #include<iostream> #include<fstream> using namespace std; class fileHandleString { private: ifstream infile; ofstream outfile; public: fileHandleString() { infile.open("input.txt", ios::in); outfile.open("output.txt", ios::in); } ~fileHandleString() { infile.close(); } string getFromFile() { string str; getline (outfile, str); return (str); } }; The above code is what I am using but I keep getting … | |
Of all things, I can't seem to get my do while loop to work. I have a running program, but get a[I] syntax error : identifier 'choice'[/I] Can't see it, any help greatly appreciated RG [CODE]#include <iostream> using namespace std; class Odometer { public: Odometer(); void reset(); void compute_fuel(); void … | |
I need some real serious help. I have been trying to get this program to work for the last past week and everytime I get one part to work and try to complet the next section the previous section craps out. I have to write a program that reads from … | |
Hi to all, I'm a newbie to C++,i have a doubt in the ofstream write function. I have a code like this ofstream* rgpostrm [BASE_LAYER]; rgpostrm [BASE_LAYER] = new ofstream (pchCmp, ios::binary | ios:ut); and some write function like rgpostrm[ENHN_LAYER]->write(rgpvoenc [ENHN_LAYER]->pOutStream () str(), rgpvoenc [ENHN_LAYER]->pOutStream () ->pcount ()); where the … | |
I am trying to modify a program to read in a file that will then output it to a new file without all the whitespace in between the data. This is so I can convert it to a csv file and read it into paraview to make a visualization of … | |
Hey all, I was wondering if any of you could help me out a little but with my functions which I'm writing for a program. I recently have noticed that I'm simply assuming the person using my program would be someone who also uses Bloodshed C++, so I think I've … | |
fin1 xx.txt -------------------- Paychecks 2500.00 Interest 100.00 fin2 xx.txt -------------------- Car_Insurance 250.00 Cell_Phone 50.00 Book 200.00 Student_Loans 180.00 Rent 950.00 fin3 xx.txt -------------------- Food 350.00 the output become --------------------- [CODE] Paychecks 2500.00 Car_Insurance 250.00 Food 350.00 Interest 100.00 Cell_Phone 50.00 Cell_Phone 50.00 Book 200.00 Student_Loans 180.00 Rent 950.00 [/CODE] ------------------------------ … | |
[code=c++] #include <cstdlib> #include <ctime> #include <iomanip> #include <iostream> using namespace std; // prototype and name space declaration int sqr(int); int cube(int); int fourthPower(int); int fifthPower(int); int sixthPower(int); bool printNum(); void show(int (*fn)(int), int); //------------------------------------------------------------------ //------------------------------------------------------------------ //------------------------------------------------------------------ void main() { char first[30], last[30]; cout << "Please Enter Your First Name: … | |
Hey folks. I am working on a program (really its 2, but they go hand in hand). The first one takes a text file which contains the following: last name first name SSN Salary Years employed There are 7 entries in the text file to be read in... The program … | |
Hey all, I was wondering if you could help me out with parts of my C++ code that I'm writing. Overview goes something like this: im making a finance recording system. So i have 5 files. one file is to save all the incomes (like a paycheck). another file is … | |
// David Barkman // CSIS 123 - Murtha // Program 13 // #include <string> #include <iostream> #include <fstream> using namespace std; void displayMenu(); void addRecord(); void searchRecords(); string userName; int main() { // Prompt fior the user name cout << "Please enter your name to begin: "; // Input the … | |
I'm having trouble with where to begin with an assignment. I'm hoping someone here will have a little more knowledge and be able to explain it to me. Just a point in the right direction please!! Here's the assignment: [B] Create a Class that reads a file completely into a … | |
I have an issue with a section of code that will not work correctly. The first instance work fine but everything after is junk data. [code=c++] int arrivaltime = 0; int servicetime = 0; int waittime = 0; // This section shows the bank wait time for the different branch … | |
Hi, I have never used a forum like this before but I am stuck! I have to write a C++ program that allows the user to enter up to 20 students info. It must include Nem, Exam 1 grade, exam 2 grade, Homework average, final exam average. For each student, … | |
Hi can someone look at this program for me it wont fill out the whole address for me and when i search or go delete it doesn't do anything. [code=c++] #include<iostream.> #include <fstream> using namespace std; struct Person { char Name[50]; char Address[80]; char Phone[30]; }; void add(); void search(); … | |
Everything is working on this program except for the output to the table at the end. It will only display the second student I enter but not the first. [CODE]#include "stdafx.h" #include <iostream> #include <fstream> #include <string> #include <cstdlib> #include <iomanip> #include <cmath> #include <vector> #include <algorithm> using namespace std; … | |
hey guys i need some help with this input file program im getting input file invalid all the time i have no idea what to do. im supposed to create data files with data for up to 10 students and calculate their average from five perecentages i think i got … | |
Hi, I have the following structure to read the file data with fixed format of my binary file. Now I want that every time my ReadFromFile function is called with 'counter' variable it should 1. return me frame specified in the 'counter'. 2. The file needs to be closed only … | |
Hi I am reading a file with number of frames. frame 1 distance [3072] intensity [3072] amplitude [3072] w_amplitude [3072] frame 2... Now I want to read the data in structure form so that I have:- frame[0].distance[0] frame[0].distance[1].... ... frame[0].amplitude[0] ... frame[1].distance[0] and so on. My code is below and … | |
Im doing a program that asks to enter a student's grades on four exams, I have to display the four grades and the average of the four grades, to the nearest tenth. The most problem im having is using the variable call total_grade which i have to initialize to zero. … | |
hello everybody... i am trying to make a project on binary files and that needs a function to modify data in a binary file. I have made the following class. [code] class example { public: char name[10], number[5]; void getdetails(); void showdetails(); example() { name[0]='\0', number[0]='\0'; } char* getname() { … | |
hi i am writing a program that counts words containing at least 3 different vowels using functions and also input files.i am confused here and don't know what to do.in this program i am to write another function that will output either 1 or 0 when a character is a … | |
Hi, I am writing an array data to a file. The data I am getting is from some sensor and need to be written in real time. I have manged to write it but I am having problem when I try to read it, as I cannot position the pointer … | |
Hey guys, I am writing a program with functions that does different things for a user. This is a program i am writing for school and my lab teachers are horrible at helping us. The problem is that i get an illegal case error for all my cases (five cases). … | |
Hello there, I met a problem which is to update inputs in a text file, but every time I update is only insert the data, not update. May anyone give me some advises? Thanks~ [code] string input; ifstream fin; ofstream fout; string title,author,category; float price; fin.open("library.txt"); cout << "******Update Book******"<<endl; … | |
Dear all gurus, Given 30 files, with same format (2 columns, column1 is string and column2 is int. contains thousands of lines) and uniform file name, eg: file1.txt, file2.txt,...,file30.txt, How can i read it in a loop, and then load them into my 2D array (eg: string words [filesize][maxline], and … | |
the last record is getting displayed twice.i hv rechecked everything and cudnt find the error. here is the add n display function. [code=c++] void add() { example abc; int n; ofstream file1("EXAMPLE.dat", ios::binary|ios::app); cout<<"Enter Number Of Records To Add "; cin>>n; cout<<endl; for ( int i = 0; i < … | |
Our group has been banging our head against the wall in this one and cannot seem to figure it out. Our program is to be able to set up menus (done), allow user(s) to input 'student names' and save them to a data (*.dat) file and add names to the … | |
hi, I am finishing up a program and in the program I need to add numbers after a certain number example for every ten numbers 30, 40, 50 i need to add .125 i have this so far if ( age > 30 % 10 == 0 ) // Formula … | |
Hello, I am trying to write data to a binary file. The function runs (the cout << "TEST" shows me that my loop is running the correct amount of times), but after the program comes to the end, it crashes and doesn't save the data to the binary file. Can … | |
Hi, I'm having problem reading a sequential file, I have done some searches all without any positive result. I trying to read a sequential file, but the problem is that the last record is read doubly. Any help would be appreciate. [CODE]#include <iostream> #include <fstream> #include <string> #include <iomanip> using … | |
I am a beginner in C++ and I need some help because my decoding is coming out as a series of numbers. Here are the detail as to what I am trying to do. I wrote 2 programs that compress and decompress a text file, each taking input and out … | |
I'll explain my issue in this way. I've use a structure to get some data of a byte stream as follows. [CODE] 1. struct pac_cont 2. { 3. unsigned int des_list ; 4. unsigned int mem_ID ; 5. unsigned char dm_con ; 6. unsigned char ser_ID ; 7. unsigned short … | |
Hi, I'm stuck with this one question we were asked to do in class...The program is to read input from a file that contains students' ids and marks and we have to determine their grades and store these variables as arrays then print it out. Then we were to create … | |
Hey, everyone. I am having getting my code to work. I have tried to add in a selection for the users. Not to mention I think I broke my table. here is the errors I get. 1>c:\users\keith\documents\visual studio 2005\projects\wk5mortgage\wk5mortgage\wk5m.cpp(51) : error C2446: '!=' : no conversion from 'int' to 'void … | |
Hey, I am a total newbie I need help finding errors in my code. [CODE] // Week 4 Individual Assignment // Calculate the monthly payment User input. // Include header files #include <iostream> #include <iomanip> #include <math.h> using std::cout; using std::endl; using std::cin; using std::ios; //Namespaces using namespace std; //Declare … | |
Let me start by saying this is my first post here at daniweb and I am pretty new at C++. With that said I will dive right in. I have a program due next week and trying to get it hammered out. I have to create a line editor that … | |
I am not sure why I am getting syntax errors in lines 29 and 31. When I run the console my return values are correct, but have syntax errors. [code] include <iostream> #include <iomanip> using std::cout; using std::cin; using std::endl; using std::setprecision; using std::ios; using std::setiosflags; int main() { //declare … | |
hey all, I'm new to this forum, and really start to like it :). Here we go. I have some trouble helping a "tute" of mine (I normally give physics tuitions) with one of his assginments on C++. As I did C++ years ago, I was feeling confident with it. … ![]() | |
i actually feel like a n00b asking this, but i'm a little of what you might call rusted in this stuff, since i hadn't need to handle files for a year now... i searched for some guide, but i only found out how to [B]open[/B] a file... like this:[code=c]ofstream *pfile; … | |
hey, i need help with this, i use VC++ 6.0 and i am having problems with opening files in multiple file modes for example [code] fstream inOutFile( "addicted.dat", ios::in | ios::out ) ; [/code] my compiler behaves abnormally, i dont know what is wrong, if i try single mod, it … | |
Sorry if this has been asked before but I have tried to find a solution elsewhere. I am using the getline function to receive input from the keyboard and save it in a text file. The problem is that it insists on printing a null character (the square box thingy) … | |
Hi Everyone, I have to read data from a file into an array. I have that part figured out. I can't get my function to work. I have to write a sumArray, avgSales, highSales, and lowSales. Here is what I got so far. Could someone please help me with one … | |
Hi guys I'm stll playing around with classes. I have some simple class, the program itself works but when I enter the value for your_account as a negative number it doesn't pass the right numbers to the private variables. Why is that? How may I fixed it Thanks [CODE] #include … | |
Hi I'm playing with a simple class. Looks like everething is fine, my compiler doesn't give me any error but there is no display on the screen. Can anyone tell me what did I miss? thanks [CODE] #include <iostream> #include <conio.h> using namespace std; class BankAccount { public: BankAccount(int dollar,int … | |
Hi, as is about to become entirely apparent, I'm a newbie programmer and I'm having some problems with what should be simple operations. I'm having some trouble writing to file and no matter what method I use I can't seem to get it to work as I hope it to. … |
The End.