2,025 Topics
![]() | |
I have to "re-write" the program that I wrote before. Here is the prompt of what to do: Overview For this assignment, re-write program 7 so that rather than using multiple arrays to hold the player information, it uses a single array of structures. The structure that will be used … | |
Hello guys! I'm having a rather pesky problem working with fstream. I could write, for example: [CODE]fstream file("text.txt");[/CODE] then file should be open in read/write mode. But then if I do the following: [CODE]file << "Some text"; file >> string_var;[/CODE] or in the opposite order, it will only perform the … | |
Made a small project to help compare two files that I am testing...but for some reason the line I highlighted isn't working as its supposed to. I originally had [CODE]c1 != c2[/CODE] and then changed it to [CODE]!strcmp(c1, c2)[/CODE] Maybe its a dumb logic bug, but would appreciate some help … | |
Hi, I need suggestions on how to count the words, letters, characters on a file . I created a program of it however, when i use the "seekp(0L,ios::beg);", it doesn't go to the beginning. I want to just close and re-open the file but I think there is a better … | |
can anyone explain to me : what is counter++ and ++counter and the different between them ? and static_cast <type_id> (expression) and setiosflags ( ios::fixed | ios::showpoint Thanks | |
I tried to write up a test program that uses std::copy and istream_iterator to copy one text file to another. But it doesn't work because the '\r' and '\n' in the file are lost. I've tried opening the input and output files in text mode and I've tried opening them … | |
Hello am trying to do this program as my project.and i was able to fix lots of errors but this few errors i do not know what to do. as my 1st and last semester for programing, am not really good in this subject. i added the errors list hope … | |
i have this assignment to submit tomorrow(friday) and i am having difficulties updating my text files. actually, i have to be able to update the text files by searching and deleting items. please, check the code below.. so far, i am receiving no errors except that the calculation part gives … | |
I need help in pulling this program apart, and reformatting it to use functions that I didn't know i needed to implement until right now. * float calculate_time (4 parameters) finds the amount of hours between two times given. It should return 0 if the amount is less than 0. … | |
The CashAndCreditShop supermarket determines the retail price of a product based on the time it is expected to stay on the shelf. Any item that is expected to sell in one week or less is marked up 10%, and any item that is expected to stay on the shelf for … | |
Can someone either explain this or give me an example of what it is asking for. Heres my code if you need it In the attached picture [CODE] /////////////////////////////////////////////////////////////////////////////// // // Name: GCD.cpp // Author: Jeffrey A. Stone // Course: CMPSC 101/121 // Purpose: Computes the GCD of two integers. … | |
hello i need to fix the problems in this program. can some one please fix them for me or give me a hint how to fix them cause i really do not know how to fix them. i also added the errors if you do not have C++ program at … | |
I have a assignment which requires the use of multiple files. I don't believe I am linking them together correctly. I'm using visual basic 2008 at the moment. Ofter I get the program working I'll create a make file and test that. I'm also not too familiar with the string.h … | |
Hey guys, I am writing a C++ program with the help of dynamic allocation of a character array. The size of the array depends on the size of file read. However, when I checked the size of allocated array, it is always 4! So, is there any limit on this … | |
Hey everyone :) Hope you can help Here is what I've done with the instructions given: I need to know the average price difference between the cash and credit prices. But i'm pretty sure that only comes in at the end. Here is what my this function is supposed to … | |
Hello there, im writing code for my asteroids game and am nearly finished but ive come across a problem when trying to load the file the save game is written like this and works perfectly fine, it saves the things i want to a text file: [CODE]void WrapGame::save() { cout<<"enter … | |
Hello every one am in real trouble now. i am in my 1st and last sem of my programing course. i need to write a program that can add delete display and update record. i got this program so far but the real prototype works fine for this program and … | |
Hey guys Here's my code that is giving me a compiler error ? Why is my darling computer complaining so horribly about what I always do with cin and cout which is give them their respective accessories >> and << ? Here's the code for the main function: int main() … | |
Hey everyone :) I'm new to c++ and have just joined this site. Looks great. Hope you guys can help. I'm having trouble with the function calcAllowedPerChild() What I want the function to do: subtract the gifts TOOTHBRUSH, HIGHLIGHTERS, CRAYONS, NOTEBOOK , AND PEN, from the amount left(leftToSpend) while the … | |
[ATTACH=left]19550[/ATTACH]Tap Me, Inc. launched the industry’s first [URL="http://tap.me/wp/how-it-works"]in-game advertising platform[/URL] this week. This platform gives designers the ability to place ads that are in context with the game being played, rather than disrupting it. Gamers will no longer have to get rid of banner ads or pop ups in order … | |
hello all, I am trying to make a menu driven program that uses a while loop and a switch in main. When i choose #1, the code seems to work. However when I type in #2, and enter data, the program goes into an infinite loop, because the menu is … | |
I NEED HELP!! I'm writing a program where the user inputs the pH Level and it goes and tells if it is a certain solution. Some of them work some don't Can somebody tell me where in my code I am going wrong. I am not asking for the solution … | |
[CODE]#define _LL_BUFFSIZE_ 2048 string lastLine; lastLine.clear(); // regardless, zero out our return string char buff[_LL_BUFFSIZE_]; // our temporary input buffer data_filet.seekg (0, ios::end); // go to end of file int length = data_filet.tellg(); // find out how large it is data_filet.seekg(length-min(length,_LL_BUFFSIZE_),ios::beg); // seek back from end a short ways // … | |
Hey, Im having some trouble with my code, it doesn't seem to stop to wait for an answer to the question about modifying the phone list when i input values in above and press Ctrl Z enter, however the code works fine when i remove the code about inputting information. … | |
I am writing an importer for a custom export script to load mesh information for models. I tested my algo with small files, 20-30 kb of information with success, but when I try something bigger like 400kb(not that big mind you), the file fails to open. This is the significant … | |
Hey. As you know I'm a newbie in C++ and I'm learning from some source codes and eBooks. I don't know if the problem is to me but when I try to compile the code an error shows. I don't know if I should copy this code but I read … | |
Hello, I started my homework and I couldn't complete it. Can anyone help me with it?? the question is: Implement the depth-first search algorithm so that it accepts input from text file in the following format: List all distinct vertex symbols (use just a single symbol: A-Z and 0-9) one … | |
hello me and my friends were assigned to make a program that can add,delete,update and show information. we were able to make this code ( am sending u ) but we cannot solve some problem like the after adding or deleting or any other work the window does not goes … | |
![]() | I have a little problem with strcmp here,the following code basically opens a file and writes to it until I enter "\esc",at which point the program should stop....but the problem is,it does not,and I can't figure out what might be the prob.Thanks for your time(I am using turbo c++ 3.0 … ![]() |
Hello guys, Firstly I want to apologize If I ask something silly, but I have just started learning C++, and I really don't know much. As a practice I have a challenge of writing a matrix in a file, and then reading the information (numbers) from it, and in the … | |
Hello I need some help as to the limitations or flexibility of header files. I have written a code that updates a base folder when it is compared to its newer version. I have hit on a roadblock though. If a new file is added to the folder, the program … | |
Can I ask what the programing languege used in iOS? I heard it was Xcode but I'm not 100% what that is, lol if anyone can give me a hand it would be great. Also (and I know this is kind of a supid queston) can you use and C++ … | |
![]() | I am getting a "misplaced break" error from this part of the code,the following is a part of the mfile function,the while loop should break if the entered string in temp equals to the one in exit....I don't know why it shouldn't work,any help?Thanks. [CODE] ofstream myfile; myfile.open(fn,ios::ate); cout<<"File has … ![]() |
hello every one am new here and really confused with my C++ subject. i saw a few post here was deleted or not answered. i hope my one wont go without answer. now here is my problem. I REALLY DUNNO what am doing. i was able to write the program … | |
All was good and properly aligned until I changed the variable type from int to double for GrossPay, GrP and totGrP. After the Hours column (from Gross Pay on), in all the rows where there are fewer digits, the Gross Pay, Tax, and Net Pay columns are left aligned, totally … | |
Hello, I am need of urgent help.I've made a program to generate bills (using goto statements) but my teacher has asked me to remove those and use something else in place of it.The problem is that I have tried using separate functions for that (It's not working properly) and I'm … | |
Hey, I am writing a program that takes the size of an nxn matrix [A], randomly creates that matrix, as well as an nx1 matrix [S], multiplies them together to create [A]*[S]=[B]. Then, using Gaussian Elimination, I use matrix [A] and [B] to find [x] such that [A]*[x]=[B]. I can … | |
My assignment is to create a program computing all kinds of employee data. Just beginning, trying to put together the basis for the rest of it, here's my code: [CODE]#include <iostream> #include <cmath> #include <iomanip> #include <fstream> using namespace std; int GrossPay(int,int); double Tax(int); int main () { ifstream empdata; … | |
I'm having trouble figuring out how to use exceptions to check if a file stream was created successfully. I know I can use if statements, but how do I do this using try/catch statements? It compiles successfully but it gives me an error when I supply a non-existent filename as … | |
Hi guys, I am trying to modify my program so that when i entered an invalid number, it will say that this is invalid and loop me back to the starting point. I just cant find the point to do that. either it will just say invalid and continues, or … | |
my switch statement is not working properly. it works fine till case 'C', after that nothing is happening. Any ideas? [CODE]void processData(List<Movies>& myList, Stack<Movies>& myStack, Queue<Movies>& myQ){ Movies movieObj; int numInStack = 0, numInQ = 0, num2process = 0; fstream inFile("newReturns.txt"); if(!inFile){ cout << "Unable to open Returns.txt." << endl; … | |
[CODE]#include <iostream> #include <cmath> #include <iomanip> using namespace std; int divides(int,int); int main () { int count = 10; //int prime = divides(count); int p = 0; // number of primes cout.setf(ios::fixed,ios::floatfield); cout << setw(6) << "NUMBER" << "\t" << setw(8) << "DIVISORS" << endl << endl; while (count<=50) { … | |
I'm wondering if its possible to program using xcode for ios(I pod touch, I phone, I pad) on windows? | |
any suggestions on this custom array class?(it compiles and works properly) [CODE]// Sequential_Sort.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <fstream> #include <Windows.h> #include <WinBase.h> /** * Class: Array * * Custom Array class used to read input from a file * … | |
I am working on a function, which is suppose to read the size of the binary file and read the data flags. The output is suppose to look something like The dataFlags are: 1 0 1 The size of the file is: 40. I got my code running, but doesn't … | |
I feel bad for asking all the questions about the STL list, and thanks to those who have been helping me learn. I have a question now about inserting again, except this time I want to insert an extra data point into a tempList. I have commented out the code … | |
Hello all, So I am having trouble figuring out a runtime error I am getting in my code. Essentially I read in data and push it into two lists (using the STL list). Then I use the .sort() function to sort the data by average. However I am having a … | |
I thought this program was as good as done, turns out, it's more broken than I thought! Right now I'm in a panic, since it's due tomorrow, and I have a few big problems with it. Problem 1: I need to either open an existing file, or a new one … | |
I want to read in multiple lines from a file, but I am only able to get my program to read the first line. The program prints out two other lines but the values are zero. [CODE] double cost[3]; int lowerRange[3]; int higherRange[3]; bool active[3]; ifstream inClientFile("ad.txt", ios::in); for (int … | |
[CODE=c++]#include <iostream> #include <fstream> #include <string> using namespace std; int main() { string linea; ifstream fileIn("input.txt"); ofstream fileOut("output.html",ios::out); //working with the input text if (!fileIn) cout<<"\nERROR: Unable to read the file!\n"; else { //working with the output text if (fileOut.is_open()) { fileOut << "<html xmlns=\"http://www.w3.org/1999/xhtml"; fileOut << "\" xml:lang=\"en\">" << … |
The End.