2,025 Topics
![]() | |
I have a quick question regarding precision printing output to cout. I need a way to print a MINIMUM number of decimal place digits to cout and also possibly have a maximum number of decimal places printed. Also, I need a way to "undo" if you will a call to … | |
I'm writing code for an address book that the information will be output to a text file in alphabetical order. I have most of the code, and I have done this kind of thing before, but it has been over a year since coding. So, just a start would be … | |
hi guys again! i want to read a bitmap in this way: please help me!! how can i read the pixels of a bitmap?? #include <iostream> #include <fstream> #include <conio.h> using namespace std; struct bitmap{ int pixel; int black; int white; }; int main(){ bitmap b[400]; ifstream a("a.bmp",ios::binary); int i=0; … | |
I'm having a bit of an issue with a while loop in a program I'm working on. I am attempting to use a while-eof loop to read float numbers from and input file and simply rewrite those files to a created output file. My issue is that the while loop … | |
suppose I have a file like below and I would like to create 3 output files based on my first field .. .i.e, 1 /2/3. Thats means 3 lines will go to the three files [CODE] 1 AAAAAA BBBBBB CCCCC 2 DDDDDD EEEEEE FFFFF 3 GGGGGG HHHHHH IIIII 2 copy … | |
Hi, I was wondering if there is any way to get the largest size of a multimap key / value. I mean something like this:- if there are 4 values in a multimap:- [CODE] my name is web_sailor [/CODE] Suppose I want to get the maximum size key / value. … | |
i am working on the output from the stack and list but i got 2 errors and i dont know how to fix it, hope some1 can help me to figure it out thank you header.h [CODE]#include <iostream> #include <fstream> #include <string> using namespace std; class Lexeme { private: string … | |
The program should: Accept a series of names and addresses from the console. The user's input should be written to a text file in the CSV format described in the lecture. But, do not include the field names in the first row of the file. Read the records from the … | |
Header File: struct BitmapHeader { unsigned char type[2]; unsigned int size;// unsigned int reserved; unsigned int offset;// unsigned int header; unsigned int width;// unsigned int height;// unsigned short planes; unsigned short bits; unsigned int compression; unsigned int dataSize; unsigned int horizontalResolution; unsigned int verticalResolution; unsigned int colors; unsigned int importantColors; … | |
My code so far opens a text file in a particular format and reads in the data into a structure called salesRecord. There is no problem there. The problem arises when I write the data to a new binary file. Here is the structure: [code=CPP] struct salesRecord { int custNo; … | |
I've written a program like the follow: [CODE]int main () { . . . . ifstream file1; ifstream file2; ofstream simiralities; simiralities.open("P(0)_P(1).txt", ios::app); file1.open("test1.txt", ios::in); while (!file1.eof()) { . . . file2.open("test2.txt", ios::in); while (!file2.eof()) { . . . . } file2.close(); } simiralities<<number; file1.close(); simiralities.close(); return 0; }[/CODE] the … | |
Yes I know its a long code and it will get longer but there is a compiler error in the [COLOR="Green"]int main ()[/COLOR] First Visual C++ 2008 Express edition error [QUOTE] ------ Build started: Project: MAC ADDRESS, Configuration: Debug Win32 ------ Compiling... MAC ADDRESS.cpp warning C4603: '_WIN32_WINNT' : macro is … | |
Ok the code below is supposed to edit a file called license.dat and replace texts in it... it works great it does all that but I want to implement user input in it. By this I mean I want the user to be able to enter the drive letter for … | |
#include <stack> #include <queue> #include <iostream> #include <fstream> using namespace std; char num[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; char ope[4] = {'+', '-', '*', '/'}; bool isope(char); bool isnum(char); int prio(char); queue<char> ReversePolish(); void write(queue<char> ch); void main() { queue<char> q; q = ReversePolish(); … | |
"Windows cannot access the specified device, path or file. You may not have the appropriate permissions to access the item... " This ios the error that I am getting, I dunno what to do anymore. YM, Splitcam, ICQ and etc aren't working... Please help me... Thanks. | |
I got stuck in this program and dont know how to start to phase 2, i finish phase 1 quite good bt i dont understand connection phase 1 and phase 2. so i hope some one can help me pls, thank you very much..... phase 2:Expand Phase 1 to translate … ![]() | |
hello everyone, I am trying to read the same file twice,but after the first reading it is not taking the value again. what i need to do is read the file once and count the number of lines in the file, then read it again and do further computations...... but … | |
I tried my code below, and i am getting a output of 0. I added lines like cout << p; and cout << alpha to see if the values are getting stored into the variables. My output looks like this -18811398930we are in the loop0 Can anyone help me?? i … | |
Hello - I love this site and often visit to search for answers to problems I have with homework. Well I finally ran into a brick wall with this one. Hopefully I can get some help, or at least pointed in the right direction. I usually can figure things out … | |
abc. txt has the following tab delimited values 100 81.7 2000 float tempFloat1; float tempFloat2; float tempFloat3; float tempFloat4; float tempFloat5; ifstream inFile ("abc.txt", ios::in); inFile >> tempFloat1; // debugger - 100 inFile >> tempFloat2; // debugger - 81.699995 WTF1??? inFile >> tempFloat3; // debugger - 100 //old school work … | |
[code=C++] // //********************************************************************************** //File Name: averages.cc //Description: Calculate the smallest, largest, and the average of the input values. //Date: 10-6-09 //********************************************************************************** #include <iostream> #include <string> using namespace std; int main() { string line; int min=2000000; int max=0; double avg; int next; double sum = 0; double count = 0; cout.setf(ios::fixed); … | |
Please help me in this homework. /* mortgage -- calculates the amount of a monthly mortgage payment based on the * principal (i.e., the amount borrowed), the annual percentage rate (APR), and * the number of years to payoff the loan. Prints an amortization schedule (table). * * The program … | |
[CODE]/* program created and maintained by red prods */ #include<stdio.h> #include<process.h> #include<graphics.h> #include<fstream.h> #include<dos.h> #include<math.h> #include<stdio.h> #include<string.h> #include<conio.h> #include<stdlib.h> #include<time.h> struct dosdate_t d; struct bank { char user[40]; long int pass; int dtj[3]; int deposit; char type[7]; char trans[100][100]; }s; char *auser[20]={"ReReEd,param"}; long int apass[2]={975369,123456}; int ENTER=13; int xi1=162,yi1=50; int … | |
Access violation (Segmentation fault) raised in your program. I received this error when I ran my program after compiling it. I can't find the error in my code. main.cpp [CODE=c]/* Main.cpp source file. Main module. Copyright 2009 (GNU CC Licence) Madcow Deity Productions */ #include <cstdlib> #include <iostream> #include "System.hpp" … | |
Heyy im a 12th grade student trying 2 put pictures in my cricket project i have 2 display pics of all players i have a code but it works only for some pictures at times it crashed down and pc shuts down any1 has a proper code to display 256 … | |
Hey i have this homework problem that i can't seem to solve. i have already did the rest of the program but i have to change the output of this program but i can't seem to make it work. the output they want is.. Home Owner Price of Home Seller's … | |
Hello everyone, I'm writing some code for an assignment that reads in a line of characters into a STL list, sorts them alphabetically and then has to reorganize them vowels to the front. Right now I'm stuck on the step of writing a function that accepts the list as a … | |
hi all, i am done with my project for lexeme but i only worked on cpp, i wonder that can i make my header file based on my cpp file? thank you this is my code [CODE]#include <iostream> #include <fstream> #include <string> using namespace std; int main () { char … | |
#include <iostream> #include <stdio.h> #include <fstream> #include <string> using namespace std; int main() { int number_Of_Lines_To_Print_From_End=0; char file_name[20]; streampos length; cout<<"enter file name that needs to be opened\n"; cin>>file_name; cout<<"enter number of lines to print from end of file\n"; cin>>number_Of_Lines_To_Print_From_End; fstream file; file.open(file_name, ios::out ); if(file.is_open()) { cout<<"the file opened\n"; … | |
[code] #include <string> #include <iostream> #include <fstream> #include <list> using namespace std; #include "mono.h" int main() { int e; string m; string z; string fname; mono * mptr; mono * mptr2; list<mono>P1; list<mono>P2; list<mono>::iterator P1itr; list<mono>::iterator P2itr; cout<<"Menu"<<endl<<endl; cout<<"A Enter two polynomials from a file"<<endl; cout<<"B Enter two polynomials via … | |
I am writing to a file the ios fixed and show point works fine through out the loop but ios left only works on my file from the second set of data on. The first set of data still stays shifted right. Here is the code, thanks in advance. [CODE]void … | |
I have this code: [icode] #include <unistd.h> #include <iostream> #include <string> #include <fstream> #include <stdio.h> #include <stdlib.h> #include <string.h> using namespace std; void add(char todo[], string priority, string home){ FILE *file; file = fopen(home.c_str(), "a"); fprintf(file, "%-50s| %-6s\n", todo, priority.c_str()); fclose(file); } void list(string home){ string line; fstream file(home.c_str(),ios::in); int … | |
Hi, this code is merely for testing a coulpe of functions for use in a bigger program, therefore this code alone may seam silly, but there is a point to it:) When i run this and press "1" the program just terminates, pressing "2" or "whatever here" works fine however? … | |
I had written a program [code] #include <fstream.h> void main() { fstream f; f.open("test.txt",ios::app|ios::in|ios::binary); cout<<f.tellg(); f.close(); } [/code] My file test.txt already contains text : " hello " i.e. 5 characters But when i try this it outputs only 0 but ios::app mode places the pointer at the end of … | |
I need to read information from a text file into a struct array. Im writing a program to make a list of favorites that the user will input. When they close the program, the array will write to a file. The next time the program is ran, i need to … | |
I'm having a ton of trouble reading the text from a file into an integer array, the file contains 3 lines of 1,000 integers from 0 to 1. The array is myArray[3][1000]. So far I've tried to use a stringstream to no avail and I've attempted to use a few … | |
I am currently working on a school assignment which requires us to read and write two kind of derived objects into a file, but i cant seem to read them in correctly once i have saved them into a .dat file. here's what i have got so far: the base … | |
I have adapted a program that implements a register of players and stores the players in a struct, with BIN file handling. Now it's not possible to use the records after they have been loaded from the BIN file. The compile is ok and both functions below are excuted without … | |
HI, I was trying to learn more about I/O with files in C++ and I can't figure out why this program can't output to the file... [code=cplusplus] #include<iostream> #include<string> #include<fstream> #include<algorithm> using namespace std; char userinp; void print_interface() { cout << "Enter E to Encrypt" << endl << "Enter D … | |
i'm with a question related to string comparing...i'm trying to compare two strings (well char pointers in fact :)), im using _stricmp for case insensitive comparison, but even with the conventional strcmp i'm not getting the result i want. [code=cpp] if(_stricmp(value,gen_arr[i])== 0){ file.seekp(-1,ios::end); file.put((i)); file.flush(); file.close(); printf("Editing of field %s … | |
[code=cplusplus]#include <iostream> using std::cout; using std::cin; using std::endl; using std::ios; #include <iomanip> using std::setiosflags; using std::setprecision; using std::setw; int main() { const int PEOPLE = 5, <strong class="highlight">PRODUCTS</strong> = 6; double sales[ PEOPLE ][ <strong class="highlight">PRODUCTS</strong> ] = { 0.0 }, value, totalSales, productSales[ <strong class="highlight">PRODUCTS</strong> ] = { 0.0 … | |
Hi, im trying to write some information into a mp3 file. The information i'm trying to introduce into the file must begin 128 bytes from the end of the file, and this block of information is identified by the string "TAG" at that position (128 bytes from the end). After … | |
Hey i have a problem about file copying. I have a source file opened with fstream and a destination file opened with FILE*...im trying to copy a chunk of the source file into the destination (the function receives as parameters the start second on the source file in which we … | |
I'm having a bit o a problem with inheritance. The context is this assignment i have in which we have to read from an mp3 file, extacting the informations within it as well as provide other informations not explicitly contained in it (for instance the total audio time of the … | |
I'm having trouble with this program from right out of the book. Its just supposed to write an integer array to a file that it creates. I've compiled it without any errors, but when I try to run it, it fails and tries to debug. can anyone help me figure … | |
Hi all I have a function writetofile() which save a record to a file but the problem is when its writting to a file it doesnt write the record in a correct order, here is the code for WriteToFile() [code=c++] void StudentC::WriteToFile() { ofstream Outfile; Outfile.open("File\\Student.txt", ios::app); Outfile << Count … | |
Hi Guys I am new at this, and I despeartely require some help. I basically need to write a program to read a text file, alter a single value and write it to a new file. I have done some stuff so far which seems to be correct, however, nothing … | |
and how i would go about fixing it? main [code] #include <iostream> #include "Format.h" #include <fstream> using namespace std; int main() { Format format; //string word; char in; ifstream infile; bool a=true; bool b=true; bool c=true; while(b==true) { cout<<"to quit type 'q'\n" <<"enter 'c' to get from console\n" <<"enter 'f' … | |
Hey All, i'm doing this project in c++ consisting in reading an mp3 file and extracting the informations within it. Thing is i'm starting to be pissed by this persistent error that stops me from test the code. This error is, as far as my (limited) knowledge goes, caused by … | |
This program is from the collopy book. I just had to type it in and create a text file so it would compile correctly for a class assignment which I did. But the very last record will not be shown when i compile. This is what is in the txt … |
The End.