2,025 Topics

Member Avatar for
Member Avatar for timbomo

error C2297: '>>' : illegal, right operand has type 'void' error C2296: '>>' : illegal, left operand has type 'float' error C2297: '>>' : illegal, right operand has type 'void' warning C4552: '>>' : operator has no effect; expected operator with side-effect. i get these errors and i dont know …

Member Avatar for kvprajapati
-2
1K
Member Avatar for dragonflare

[CODE]#include <iostream.h> #include <fstream.h> #include <stdlib.h> #include <string> using namespace std; //const int MAX_SIZE = 10; //char determine_grade(int smarks); class student{ public: student(); //constructor ~student(); //destructor //char grade; //set values void set_mark(int); void set_id(string); void print_students_records(student, int); //get values int get_mark(); string get_id(); private: int mark; string id; }; //void …

Member Avatar for NathanOliver
0
167
Member Avatar for yznk

I am writing a program that implements a topological sort. The actual question is as follows : Given a collection of n items and dependency lists for each item, determine whether the dependencies support a topological sort. If not, report this fact. Otherwise, find a topological sort of the vertices …

Member Avatar for yznk
0
115
Member Avatar for Naloth

I'm getting errors at every occurrence of my void definitions. "expected primary-expression before "void"" and "expected ';' before "void"" at my "void displayMenu ()" "a function-definition is not allowed here before '{" token" "expected ',' or ';' before '{' token' " At every future occurrence of void. Any ideas? I've …

Member Avatar for Naloth
0
162
Member Avatar for CleanSanchez

My assignment is to find the sum of an array, sum of the cubes of the array (i.e. each value raised to the power 3) and the variance of the array. At the moment I'm getting compilation errors so I can't do any trial and error. My problem conceptually is …

Member Avatar for CleanSanchez
0
832
Member Avatar for inisca

Hello all, First of all i am a beginner in vc++, so excuse my question if its simple. I was wondering if I could use the data from button1 in button 2 my code is: [CODE] public:System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { OpenFileDialog open; open.Title = "Select Wave File"; open.Multiselect …

Member Avatar for Fbody
0
191
Member Avatar for bandit711

How can i change this code to get a output like this: This Program Average grades and output the average and letter grade Quiz1 Quiz2 Quiz3 Quiz4 Average Grade s1 70 80 90 95 83.75 B s2 95 85 90 80 87.5 B s3 75 85 70 80 77.5 C …

Member Avatar for chiwawa10
0
104
Member Avatar for bandit711

Having problem set code up for five rows and 4 column. Any ideas have too do it the code, i am currently using: [CODE] cout << setfill(' ') <<setiosflags(ios::left) << setw(11) << "Student" << setw(10) << "Quiz1" << setw(8) << "Quiz2" << setw(8) << "Quiz3" << setw(8) << "Quiz4" << …

Member Avatar for bandit711
0
172
Member Avatar for bandit711

Every time i compile this code i come up with a additional set of numbers, but i don't know why. [CODE] #include <iostream> #include <stdlib.h> #include <iomanip> #include <string> #include <fstream> using namespace std; void calculateAverage(double quiz1, double quiz2, double quiz3, double test4, double& SAverage); int calculateGrade(double grade); int main() …

Member Avatar for bandit711
0
165
Member Avatar for jigglymig1

my code is supposed to read in a binary file and then save the input to a text file. when i cout << coach[i] i get the output and jibberish [CODE]#include <iostream> #include <string> #include <cctype> #include <fstream> #include <cstdlib> using namespace std; int main() { char coach[500]; int i=0; …

Member Avatar for WaltP
0
130
Member Avatar for vizionary2012

Hello i am a new member of this and i was trying to include a matrix effect similar to the one at the beginning of the movie and it involves using the iostream header file, is there any replacement for this file cuz i tried using ios, and iostream and …

Member Avatar for gerard4143
0
97
Member Avatar for EgyCoder

Why does seekg() work only in the first iteration, while in the second iteration it doesn't.?However I used it in previous cases and it worked perfectly. And yes, I'm using clear(), but still nothing shows up after the first iteration (the iteration of the big while loop that encloses this …

Member Avatar for EgyCoder
0
206
Member Avatar for Bart_sg

[code]#include <iostream> #include <iomanip> #include <string> #include <ios> using std::string; using std::streamsize; using std::setprecision; using namespace std; int main() { double Ib,I,V,P,F,pf,In; unsigned short int type; cout<<"Please select the type of power supply\n";//Allows the user to choose between single or three phase cin>>type; switch(type) { case 1:cout<<"You have chosen a …

Member Avatar for Mikstaslaya
0
170
Member Avatar for sportsguy90

Hey all. I'm having trouble developing an order program. Basically I have to compare two files, and validate that one equals the other. I have figured out how to determine whether the order data is valid or not, but i'm unsure how to go about writing out which pieces of …

Member Avatar for WaltP
0
133
Member Avatar for c1979h

I have one error in my code Error 1 fatal error C1075: end of file found before the left brace '{' at line 50 The program is suppose to ask the user for a filename, read and display the file. Then show 24 lines per screen. I thought I checked …

Member Avatar for c1979h
0
204
Member Avatar for Divyab

hey plzz help... i'm encountering many errors in dis code segment.. plz try n remove d errors asap... n tell me how to generate a database in C++[code]/* ----------------------------------------------------------------------------- -------------- PROGRAM TO IMPLEMENT THE PAYROLL OF EMPLOYEES ---------------- ----------------------------------------------------------------------------- */ #include<fstream.h> #include<fstream.h> #include<conio.h> #include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX 50 // …

Member Avatar for LevyDee
0
154
Member Avatar for jcps65

What up yall, Im working on this program that reads in strings and numbers from text file and store them into an parallel arrays. My program also needs to: "list each sales person ID,name,sales amount, and commissions" "list each month of the year and total sales for the month for …

Member Avatar for Salem
0
96
Member Avatar for pinsickle

I have a weird file i/o or system() error. Here is the deal, I completed an assignment for threaded trees recently. My professor wanted us to turn in own data set we used to test our tree along with the one he provided for us. I thought I'd be fancy …

0
62
Member Avatar for moqbel

[CODE] #include<iostream> #include<fstream> #include<string> using namespace std; void main() { //decleration ifstream source; ofstream target; char * box; int width, height, numlevel; string s; int amount= 100; //-------------------- source.open("1.ppm",ios::binary); while(source.fail()) { cout<<"can not open the file"<<endl; // to make sure the file is opened } source>> s; if ( s …

Member Avatar for moqbel
0
96
Member Avatar for some

Hello everyone, I have a question regarding advanced file manipulation. I am trying to make a function that will take in a number which will be the number of a record and basically take that record out and display its contents and let the user edit it. Here is the …

Member Avatar for SCarlisle
0
114
Member Avatar for aa_day90

I haven't got any luck finding why this program wouldn't work. Here's the code. [CODE]int main (void) { ifstream file; char *streamer = NULL; file.open("now.txt", ios::in | ios::binary); if (file.is_open()) { while (!file.eof()) { streamer = new char[33]; cout << "Prestream: " << streamer << endl; file.read(streamer, 32); cout << …

Member Avatar for aa_day90
0
96
Member Avatar for Reprise

In my program I am creating a class instance then writing it to a binary file. I do this several times so I have several instances of this class in my file. Then I want to access them individually, read them back into an instance in the program, change its …

Member Avatar for Reprise
0
241
Member Avatar for moqbel

[CODE] #include<iostream> #include<fstream> #include<string> using namespace std; void main() { //decleration ifstream source; ofstream target; char * box; int width, height, numlevel; string s; int amount= 100; //-------------------- source.open("1.ppm",ios::binary); while(source.fail()) { cout<<"can not open the file"<<endl; // to make sure the file is opened } source>> s; if ( s …

Member Avatar for moqbel
0
267
Member Avatar for bandit711

[CODE] #include <iostream> #include <fstream> // I/O #include <iomanip> // For setw() using namespace std; ofstream outputfile("output.txt"); // Output file const int MAX_FILE_NAME = 35; const double INTEREST_RATE1 = 0.010; const double INTEREST_RATE2 = 0.010; const double LEVEL_ONE_BALANCE = 1000.00; const double MINIMUM_PAYMENT = 10.00; const double MINIMUM_PAYMENT_PERCENT = 0.10; …

Member Avatar for bandit711
0
139
Member Avatar for caribedude

I've been trying to make a program that can read some information from a file and store it in memory to compare with user input. It's sort of a quiz with organic synthesis. A synthesis is dived into steps so I chose to make a synthesis a vector of vector …

Member Avatar for caribedude
0
103
Member Avatar for goulda660

I have been trying to write this program for this class that I'm in. The main objective is to make it able to save drivers to a file and then just be able to look up the drivers and then save them back to the file. I thought that if …

Member Avatar for daviddoria
0
208
Member Avatar for atticusr5

hey everyone, newbie programmer here, and i am working on a project to use linked lists, by creating a linked list class. basically i am using old code and modifying it to work with a linked list class. i am using visual studio to debugg, and it seems that my …

Member Avatar for atticusr5
0
171
Member Avatar for tallygal

We are doing an assignment that reads from a file on the hard drive, asks for user input and then writes it to a different file on the hard drive. We have to use three different functions, besides the main, and cannot use global variables. I cannot seem to get …

Member Avatar for tallygal
0
134
Member Avatar for bandit711

Cant figure out whats wrong with code. This is code should "write a program to compute the interest due, total amount due, and the minimum payment for a revolving credit account. The program accepts account balance as input from a file, then adds on the interest to get the total …

Member Avatar for bandit711
0
293
Member Avatar for tallygal

I am inputing from a text file, displaying it on the screen, displaying the menus and the choosing from there. It will repeat the menu, but, how to do I get it to read the next line in my input file and display it to the screen before repeating the …

Member Avatar for tallygal
0
112
Member Avatar for smeghead007

I need to read a file into a struct so i can print out a monthly bank statement after adding all deposits and with drawkls from another file but im having trouble reading the fileinto the array this is what i have so far.. [CODE]#include <iostream> // Need for cout,cin …

Member Avatar for abhimanipal
0
116
Member Avatar for smeghead007

Ok what I need to do is utilize a binary search algorithm and determine the index location of a set of keys. The keys are in the file the user enters along with the numbers that have to be searched through. But im lost on how to do this. Do …

Member Avatar for WaltP
0
104
Member Avatar for tallygal

This program compiles and lets me select a letter from the menu, but then it just repeats the menu, it never outputs the statements that correspond with the letter chosen. Any ideas why? [CODE] #include <iostream> #include <iomanip> #include <fstream> #include <cstdlib> using namespace std; //Function Prototypes void accept (); …

Member Avatar for tallygal
0
269
Member Avatar for jcps65

Hey Everyone, im struggling with this C++ assignment that my instructor assigned so i appreciate all the help that i can get. I have to read in the data from the text file and store it into parrallel arrays. My Text File looks like this: Darwin 103 04 20 2001 …

Member Avatar for WaltP
0
144
Member Avatar for tinkeydo

The following is an excerpt from a complete program that runs without any errors. It has 2 file dependencies which it uses to access and store information. The program, in its entirety, displays a menu with 4 options the user can choose from. [LIST=1] [*]View Characters [*]View Items [*]Add Character …

Member Avatar for tinkeydo
0
183
Member Avatar for restrictment

Well, I had my program running perfectly, and I was quite pleased with the results. However, after I made the text file a bit big, the program just stopped working all together. (255 lines of text) so I 'suppose' it is a bandwidth problem..however 255 lines of text is like …

Member Avatar for david.k
0
176
Member Avatar for bushimports

Below is the code I have for doing this but something is really wrong . Filenames is the container I am using. Filename is a string. [CODE] void SaveFileName(){ ofstream out; out.open("..\\..\\Bush Breakout 3D\\Exe\\Level\\filenames.txt",ios::out | ios::app | ios::binary); // out.seekp(0,ios::end); int size = Filenames.size(); for(int i = 0;i < size;++i){ …

Member Avatar for Ancient Dragon
0
237
Member Avatar for dinamit875

I am having problem with saving and retrieving information from a file, program saves info to a flight.txt file its in the file, but debugger breaks as soon as i am trying to display content here's the code: [code] #include <iostream> #include <cstring> #include <string> #include <iomanip> #include <cstdlib> #include …

Member Avatar for mitrmkar
0
144
Member Avatar for sfurlow2

For my project, we're supposed to read data from a text file (circlemath.txt) and the program should output data for the circle to a text file (circoutput.txt). The input file contains data specific for class Circle (x-coordinate, y-coordinate, radius, ascii character), and each line has the form (Circle1 data, operator …

Member Avatar for sfurlow2
0
107
Member Avatar for smeghead007

Ok I got the code to work but with some errors. First when i print out the aorted array to the file it is sorted escept for one number in the beginning second it gives me a negative number whihc i believe is a pointer how can i fix this? …

Member Avatar for VernonDozier
0
135
Member Avatar for restrictment

Heh, well my daily project is near finished, and I was looking around for a way to get rid of punctuation from a character array. I looked through the web a bit, and only found immensely complicated formulas which I did not feel like dealing with. So my question is: …

Member Avatar for restrictment
0
213
Member Avatar for smeghead007

ok guys I need your help. Im still new to C++ and what I need to do is read a .txt file into an array. The file consits of number like this ie 345 55555 56788765 5444 333 22 3 55656757 etc.... then I need to sort them using the …

Member Avatar for smeghead007
0
139
Member Avatar for pinknblu

Question: how do i get the average to come out, correctly. The first avg., should be 85, next second one: 85.5, then student three: 80. Here's my code: [code]#include <iostream> #include <iomanip> using namespace std; void handleOneStudent(int N); int main() { int NumberOfStudents; cout << "How many students are in …

Member Avatar for pinknblu
0
340
Member Avatar for Alviery

It happens that I am doing a project for my computer class, but it seems not to work. This is the project : An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at …

Member Avatar for anup375
0
98
Member Avatar for lighten123

For Making long description short see my case: [code] suppose, path: "../defult123/test.txt" my code: ofstream fout("../defult123/test.txt",ios::out); Here in "defult123", "default" is static but "123" is dynamic .So Basically path should be written as: "../default***/test.txt" [/code] So how can i access this dynamic path for writing in test.txt file. [code] so …

Member Avatar for Salem
0
96
Member Avatar for tarheelfan_08

Ok guys, for my next assignment I have to read from a binary file and then print out my information. I will post the assignment and what I have so far. But my question is, do I create the binary file first in the program or by hand or what?? …

Member Avatar for tarheelfan_08
0
3K
Member Avatar for tcsarindam

Using different objects for input and output the above code is not working. Pls give suggestion ASAP. [code]#include<iostream> #include<fstream> #include<iomanip> using namespace std; class sample { int num; char name[20]; public: void read() { cout<<"\n enter name"; gets(name); cout<<"enter the number"; cin>>num; } void write() { cout<<"\n The name is"<<name<<endl; …

Member Avatar for Salem
-1
88
Member Avatar for conkjj8

I am trying to change the array in this program from a static array into a dynamic array. I'm totally lost on this one and could use a little help. There are a few other problems in the program, but the only thing I'm worried about right now is getting …

Member Avatar for jonsca
3
310
Member Avatar for BrandonB

Hi all, Im currently doing an assignment where we have been told to write a program to input 2 values (namely the area of wallspace to be painted & the price of the paint) & then output several other values based on the values input. At this point I'm writing …

Member Avatar for BrandonB
0
141
Member Avatar for nerdy900

I was starting a cash register program. I got to the point of a simple test. I ran into a problem where when running the loop to input my variables, it completely blows through the loop the first time. I looks like this: Product: Product: ---------now I could input [CODE]#include …

Member Avatar for nerdy900
0
136

The End.