2,025 Topics

Member Avatar for
Member Avatar for Lanor

Hi...I am not able to input text file correctly as desired...... data.txt -------- Jim A James A+ Smith Cathy D Dazy Peter C I am suppose to input the above file and fill the above data in two seperate arrays. For the second column, I am suppose fill NULL value …

Member Avatar for WaltP
0
100
Member Avatar for HBK_100

I have the following in the txt file [CODE] 1 Single.Standard Standard Empty ......... ........ 70 2 Single Standard Empty ........ ....... 70 [/CODE] I ahve the code below buts its not deleting the selected id [CODE] while(!file.eof()) { file >> roomnumber >> category >> type >> status >> datein …

Member Avatar for HBK_100
0
103
Member Avatar for Leppie

Advice sought? Hi, I'm trying to create a program that when run ten times (closing inbetween) then throws up a message. My thoughts on this is to get my application to create a dat file storing 0 (Zero) in it, then have my application read the dat file for input …

Member Avatar for Fbody
0
211
Member Avatar for dgreene1210

hey I was wondering if anyone out here can help me with C++ and also adding a loop at the end to be able to ask the user if they want to look up another part. attached is the string code i was given. #include <fstream> #include <iostream> #include <string> …

Member Avatar for Taywin
0
173
Member Avatar for jmcorpse

Can someone help me figure out how to either round up or down down the numbers? The numbers are used with the asterisks in the bar graph. I'm not sure if I should be using fmod or the round function. Any help would be appreciated. [CODE] #include<iostream> #include<iomanip> #include<cmath> using …

Member Avatar for jmcorpse
0
325
Member Avatar for HBK_100

Why is this not reading from the file The contents of the file [CODE] 123456 James.Watson 234567 12.Clover.Crescent Spanish.Town St.Catherine Single Standard Passprot [/CODE] [CODE] ifstream file; file.open( "guest.txt", ios::in ); if ( !file ) { cerr << "File could not be opened" << endl; exit( 1 ); } guest …

Member Avatar for thelamb
0
88
Member Avatar for xikkub

I'm writing an application to patch assembler instructions according to memory addresses. I have been using C/stdio for FILE operations (fopen, fseek, fprintf), but I would like to have a C++/fstream implementation as well (.open, .seekp, .put). I've had no problems patching file memory with stdio, but fstream/ofstream methods corrupt …

Member Avatar for xikkub
0
234
Member Avatar for HBK_100

I have a file txt file with the contents [TEX]10031James Cameron2346789Spanish TownSt.Catherine12 Clover CrescentDeluxeSinglePassport[/TEX] I want to read from the file baesd on a seraching fro the id number and returning the datat to a class. But it seems I can't read from the file. Heres is the code below. …

Member Avatar for Lerner
0
154
Member Avatar for integer*09

Hi all, I got this assertion problem that i cant seem to solve, could you guys help me on this. So far, i think the problem might be due to the while loop for the iterator line by line check and i have made changes to it but still cant …

Member Avatar for shijobaby
0
771
Member Avatar for reallynewbie

I'm trying to make a program where it will add up the letter grade entered and give how many students made an A, B,C etc... I'm stuck and not sure what to do next some things may be out of line, due to I was trying different things and not …

Member Avatar for reallynewbie
0
56
Member Avatar for TheGlyde

[CODE] #ifndef LexA_H #define LexA_H #include <iostream> using namespace std; class LexA { public: int charClass, lexLen, token, nextToken; char lexeme[100], nextChar; private: char character; public: LexA(); void setChar(char); void addChar(); void getChar(); void getNonBlank(); int lex(); int lookup(char); #define int_lit 10; #define ident 11; #define assign_op 20; #define add_op …

0
75
Member Avatar for danish_izads

[CODE]#include<fstream.h> #include<stdio.h> #include<string.h> char num; int don; class sudoku { public: void putin(); int retchar(); void putout(); char name[30]; int a1,a2,a3,a4,a5,a6,a7,a8,a9,b1,b2,b3,b4,b5,b6,b7,b8,b9,c1,c2,c3,c4,c5,c6,c7,c8,c9,d1,d2,d3,d4,d5,d6,d7,d8,d9,e1,e2,e3,e4,e5,e6,e7,e8,e9,f1,f2,f3,f4,f5,f6,f7,f8,f9,g1,g2,g3,g4,g5,g6,g7,g8,g9,h1,h4,h2,h3,h5,h6,h7,h8,h9,i1,i2,i3,i4,i5,i6,i7,i8,i9; }; void sudoku::putin() { cout<<"\nEnter the Character of Sudoku "; cin>>num; cout<<"\nEnter the Name of Sudoku "; gets(name); cout<<"\nEnter the Values of first row "; cin>>a1>>a2>>a3>>a4>>a5>>a6>>a7>>a8>>a9; cout<<"\nEnter the Values …

Member Avatar for danish_izads
0
183
Member Avatar for claudiordgz

Hi guys, I'm new at C++ and I'm learning the basics on binary files This is what I've done: 1.- I created a class Criminal with basic data (age, crime type, criminal name) [CODE] class Criminal { private: int vnSerie; char vNombre[ 36 ]; char vtCrimen[ 20 ]; int vEdad; …

Member Avatar for Ketsuekiame
0
191
Member Avatar for zathura

i dont know what happen..when i complie..there's error... so..what suppose i do??please.. [CODE]#include<dfp.h> CMatrix CDfp::operator()(double(*p)(CMatrix&),CMatrix& X0,double e) { pfun=p,n=X0.getrow(); X.set(n,1),S.set(n,1); X=X0, error=e; CMatrix B(n,n),B0(n,n); CMatrix TiDu(n,1),TiDu0(n,1); CMatrix DG(n,1),DGT(1,n),DX(n,1),DXT(1,n); CMatrix E(n,n); CDiffer differ; double a; double dfm; int flag(0); int k(1),c(1); for(int i=1;i<=n;i++) B(i,i)=1; B0=B; TiDu=differ(pfun,X,error/10); dfm=TiDu.getmod(); ofstream out(".//result.txt",ios::ate); for(k;k<=n;k++) { …

Member Avatar for sundip
0
138
Member Avatar for orwell84

I'm currently in the process of getting a CCNA certification (well, beginning to, anyway) and I'm starting to think about what kind of setup I should have to experiment with and observe network communications. Packet Tracer is useful, but it isn't meant to be a replacement for actual routers and …

Member Avatar for orwell84
0
135
Member Avatar for WhoCares357

I'm trying to read some input from a file and print it. I have three files: Main.cpp Sudoku.cpp Sudoku.h. For some reason the program will not print anything unless it's in the main function. If I print anything in one of the functions of Sudoku.cpp file and the use that …

Member Avatar for WhoCares357
0
593
Member Avatar for Crucial

I have been reading up on this forum looking for answers to my own questions but i find myself stumpped. I basically have to read from a file the last ten lines of input. Yes this is for a homework assignment and i have spent hours on it reading my …

Member Avatar for mike_2000_17
0
184
Member Avatar for usccapo

Please help me this question is givin me so much stress. This program is for you to get familiar with file IOs in Java as well as writing methods. Write a program that asks the user for a file name that contains a line delimited records of student applications. Each …

Member Avatar for peter_budo
-1
135
Member Avatar for Ilyana

[code] #include <cstdlib> #include <iostream> #include <iomanip> #include <fstream> using namespace std; int main() { const int SIZE=81; char input[SIZE]; fstream nameFile; nameFile.open("Bands.txt", ios::in); if (!nameFile) { cout << "Error: Cannot open file." << endl; return 0; } nameFile.getline(input, SIZE); while (!nameFile.eof()) { cout << input << endl; nameFile.getline(input, SIZE); …

Member Avatar for Ilyana
0
102
Member Avatar for BlueZephyr

I am have some really weird iostream errors. This is my first time using functions. Maybe I did something completely wrong. I just need someone to point out my error and maybe help with building a function to find the minimum value out of 4 input numbers. [code=c] #include <iostream> …

Member Avatar for BlueZephyr
0
120
Member Avatar for azim_axl

Hi all, I'm new to C++ & taking my first class in programming. The program ask the user to enter the loan amount, number of years, and interest rate, and then displays the amortization schedule for the loan.The monthly payment for a given loan pays the principal and the interest. …

Member Avatar for Ancient Dragon
0
977
Member Avatar for andimiami

How do I write this C++ sentinel-controlled while loop? I need to write a sentinel-controlled while loop to see if the coefficients of a quadratic equation have real roots using a nested decision. A character q must be my sentinel. This is what I have so far, but it doesn't …

Member Avatar for Ancient Dragon
0
732
Member Avatar for UZU309

Hello all, I am trying to figure out how to make my program do the following(it's a table): The user enters a beginning amount and interest rate. The year, beginning amount, interest and end amount are all supposed to keep increasing until the end amount is doubled of the beginning …

0
66
Member Avatar for Christ1m

I have this following code. It runs. Im trying to implement remove, sort, and find functions in to this program but I do not know how to. I need some ideas. Find - User inputs the song title. If it finds the song title, it will displays the given info …

Member Avatar for Ancient Dragon
0
93
Member Avatar for vavazoom

[CODE] #include <iostream> #include <fstream> using namespace std; int main (int argc, char* argv[]) { int length; char * buffer; string searchWord = argv[2]; string compareStr; int searchSize = searchWord.size(); ifstream readFile; readFile.open (argv[1], ios::in ); ofstream writeFile; writeFile.open("newData.txt", ios::out); readFile.seekg (0, ios::end); length = readFile.tellg(); readFile.seekg (0, ios::beg); buffer …

Member Avatar for vavazoom
0
171
Member Avatar for Kontained

Hi all, I'm currently working on a RC4 project for my computer security class. I have looked at the [URL="http://en.wikipedia.org/wiki/RC4"]wikipedia page[/URL] for RC4, and I'm trying to adapt that algorithm to my problem. I can get the correct encrypted text when I just cout the values. However, when I try …

Member Avatar for Kontained
0
3K
Member Avatar for ranko_6

Trying to write a simple program that will read data but keep stumbling upon the fact that I kinda can't limit the amount that is read. I have simple student.dat file which is filled ATM with nothing else but simple string "somethinginside", without quotes. When I do this on each …

Member Avatar for ranko_6
0
208
Member Avatar for Metsuba

[CODE]using namespace std; #include <iostream> #include <fstream> #include <string> #include <cstring> int main() { ifstream InStream; string InFile; string InToken; cout << "Please enter the filename: " << endl; cin >> InFile; InStream.open( InFile.c_str(), ios::in ); if (InStream.fail()) { cerr << "Unable to open '" << InFile << "' for …

Member Avatar for Metsuba
0
75
Member Avatar for awadojag

I'm working with a program where the user adds a few names together with the age. After this the program will write out the content of the text file. I'm having problems seperating the names and age into different variables. I want the program to put word nr1 in char …

Member Avatar for mayyubiradar
0
158
Member Avatar for sasucker

For my assignment this week, I was supposed to create a program that would read in names from a file, sort them, then output the names sorted. I attempted to do it as a insertion sort, and seemed to have failed miserably... if anybody could point me in the right …

Member Avatar for llk
0
2K
Member Avatar for themaestro

[CODE]#include <iostream> #include <fstream> #include <cstdlib> #include <conio.h> #include <iomanip> #include <ctype.h> #include <windows.h> #include <cstring> #include <ctime> using namespace std; int main() { ofstream outputparticulars("particulars.txt",ios::out); int d,a,b,c; char ic[100],password[100],confirmpassword[100]; char info[6][101]; cin>>d; if(d==1) {cout<<"1"<<endl; } else if(d==3) { cout<<" Key in your......\n"; cout<<" First Name : "; cin.getline(info[0],100); outputparticulars<<" …

Member Avatar for themaestro
0
128
Member Avatar for awadojag

Im trying to learn working with text files and I been able to make a program adding text to a text file. However I have no clue how to make it so I'm able to add numbers to the text file. I want the program first ask for the name …

Member Avatar for Fbody
0
101
Member Avatar for Vllinator

Hi i'm writing a program that reads records from a file, then sorts these records by the person's firstname, and stores the sorted data in a new file. Heres the code: Everything works fine, except it stores garbage at the end of the last record. If i set the array …

Member Avatar for Vllinator
0
143
Member Avatar for hockeygurl35

I'm working on an assignment where we are to implement an address book that holds standard information (ie. Name, Address, City, State, Zip) and contains a user interface to provide options to add, delete, or modify records, search for a specific record, or display all records. These operations are to …

Member Avatar for hockeygurl35
0
190
Member Avatar for mitrious

I "miss wrote" the name of the book ... sorry ahhaha accelerated hhahah why did I write advanced ... damn =S ahha 4-2. Write a program to calculate the squares of int values up to 100. The program should write two columns: The first lists the value; the second contains …

Member Avatar for daviddoria
0
149
Member Avatar for mtron10

for my computer programming class, we are suppose to create a program that asks the user to enter a file name, and after the file is brought up the next step is for a cloze text to pop up. we are suppose to write the code for that every 5th …

Member Avatar for daviddoria
0
85
Member Avatar for Anthony Ajax

I have to create a program that will read both of these files and print them to the Win32 Console. After it does this, I have to reread the file replacing every fifth word with 10 underscores. My code works correctly for the austin.txt file, but it counts the first …

0
94
Member Avatar for burcin erek

[CODE] #include<iostream> #include<fstream> #include<conio.h> #include<stdlib.h> using namespace std; void write(); void rear(); void search(); void write() { int no; char name[80],surname[80]; ofstream file("student.txt",ios::out|ios::app); cout<<"name:"; cin>>name; cout<<"surname :"; cin>>surname; cout<<"number :"; cin>>no; file<<name<<""<<surname<<""<<no<<"\n"; file.close(); } void read() { string line; ifstream file("student.txt",ios::in); if(!file){cout<<"file not found.\n"; getch(); exit(1);} while(!file.eof()) { getline(file,line); cout<<line<<endl; …

Member Avatar for burcin erek
0
204
Member Avatar for bigwhiteegg

I had just started learning C++ for couple months n this program is involved with pointer there is a bug in my "doInsert" function however, I dont seem to be able to figure out what is wrong with it every time after I enter the "position" the program crashed can …

Member Avatar for bigwhiteegg
0
130
Member Avatar for Spartan_MSU12

I am trying to complete this program. It is excuting the second part of it, Which every 5th word needs to be replaced with an underline. But I need to print out the text with out the underlines first. then have it replaced with underlines. Also, the user has to …

Member Avatar for Ancient Dragon
0
127
Member Avatar for Bri426

Hey everyone :) I'm writing a program for my class that has the user input 5 test scores and then from the inputted numbers, return the letter grade. I've begun writing the LetterGrade function, but it's not working. I'm getting a strange array of numbers/letters instead of the actual letter …

Member Avatar for mrnutty
0
144
Member Avatar for usagi

Hi everyone at daniweb! First off I want to say thanks for starting this awesome homepage, though googleing ive found many clues and answers in here for my projects, things that were left undocumented or just poorly explained by those books that ive used. But now, onto the issue! What …

Member Avatar for usagi
0
203
Member Avatar for nerdygirl118

Hi, I'm in a beginning class in C++ and we need to make an assignment that inputs a file, prints it to the screen, and then prints it to the screen again with an underscore every 5 blanks. I got the last part to work, but I can't get it …

Member Avatar for nerdygirl118
0
149
Member Avatar for crazylunatic

I have been doing a small project as part of my lab assignments and I encountered this funny probelm while working with the files in C++. I have this class Member which I am using to store the member details. [code=c++] class Member { private: char name[30]; long int userid; …

Member Avatar for deeps84
1
342
Member Avatar for anantk

I'm working on a soccer management program I had some other members of my group to compile data on 400 real life players into a text file. I planned on reading the text file using a program ,converting individual players into objects and then writing them to another file (in …

Member Avatar for anantk
0
131
Member Avatar for smeghead007

ok guys I need your help. What i need to do is create a program that prints out a user specified pattern. the user specifies the size and which pattern. the patterns should llok like this Patter 1 Pattern 2 Pattern 3 Pattern 4 5$$$$ $$$$5 $$$$$ $$$$$ $5$$$ $$$5$ …

Member Avatar for smeghead007
0
157
Member Avatar for ziggystarman

Hello I'm looking for the correct method/way for reading & writing raw JPEG image binary data. I am obtaining the raw data via TCP stream, the official JPEG specs say that the raw JPEG image data starts at HEX value 0xffd8 & ends at HEX value 0xffd9 as below... [CODE]Start …

0
109
Member Avatar for tongdl04

Hello, I am a newbie in C++ programming. I try to write a C++ program to first read and split a hugh text file (that containing multiple small files inside it) into multiple small text files, then I need to write the first line of each small text file into …

Member Avatar for tongdl04
0
559
Member Avatar for praky

I am writing a code for arithmetic compression. But my problem is i can't open the file 2nd time for reading. code is: [CODE] #include<iostream> #include<fstream> #include<stdio.h> #include<math.h> using namespace std; #define MAX_SYM 255 struct node { char ch; int count; /*public: node() { //cout<<"constructor at work. \n"; count =0; …

Member Avatar for praky
0
91
Member Avatar for lukename

Hello guys. I have some problems with ofstream and CFileDialog. I use this code to get file location: [CODE]CFileDialog fileDlg(TRUE); if (fileDlg.DoModal() == IDOK) { FilePath = fileDlg.GetPathName();[/CODE] And after that i try to write something to file wich don't exists. So ofstream have to create a new one. [CODE]std::ofstream …

0
57

The End.