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