Member Avatar

Hi guys, I am confused on how can I access a same class reference object , that is created in class ReadInoiceFile, and be accessed in ReadErrorFile. To be more specific: I have a class called Transaction And then I have a class called ReadInvoiceFile. And finally I have a class called ReadErrorFile. So if I create a reference object of Transaction in ReadInvoiceFile and use the mutator method setOrderNumber to set a value of a variable called OrderNumber, how can I get access to that value in class ReadErrorFile. Because if I create a reference object of Transacton in …

Member Avatar
+0 forum 3
Member Avatar

Hi, I declared and implemented a print() function in a class. But when I call this function it is giving me an error: which says that function does not take 0 arguments. But what should my arguments be. I have posted the part of the code for more specification. Thanks. [code] /************class header******************************/ class addressType { private: string St_address; string city, state; int Zip; public: void print_add(string, string, string, int); void get_add(); void set_add(string, string, string, int); addressType(); ~addressType(); }; #endif /*****************implementation of print & set function*****/ void addressType::set_add(string street, string cit, string st, int zip) { St_address = street; …

Member Avatar
+0 forum 5
Member Avatar

I am writing a program in which a print function takes in users' street address(string), city (string) , state (string), zip(int). What will my return be for this function? My code snippet is this: [code] string addressType::print_add(string str, string Cit, string St, int Z) { cout<<str<<endl; cout<< Cit <<","<<St<<endl; cout<<"Zip: "<<Z<<endl; return ;//what should I return here? } [/code] Thanks.

Member Avatar
+0 forum 1
Member Avatar

Hi I am writing a address book program that is giving a run time error. Please if someone can compile and check this error, and then explain/ show me how can I resolve it. I am pasting my code in parts here as well as attaching the files. Also please someone explain me, how can I print the user input address in the main(). I mean what should my argument be for the print_add() when I call it in main(). I really appreciate your help. Thanks. [code] /**********Header file*****************/ #ifndef addressType_H #include<iostream> #include<iomanip> #include<string> using namespace std; class addressType { …

Member Avatar
+0 forum 1
Member Avatar

Please can someone show me how would I create a file using fstream that would take the contents from another existing file and user input sentence. for example: I have file1 with some contents The user inputs a sentence Now I want to create a file using streams that has contents of file1 and sentence. My possible coding [code] ofstream output; output.open("file2.txt"); output<<file1 + sentence<<endl; output.close(); [/code] To me something in the code does not seem right.

Member Avatar
+0 forum 4
Member Avatar

I am trying to read a file from fstream in a switch statement but something in the code seems to be stopping this part of my code to be read by the compiler. Please some one let me know what am I doing wrong. Its not the text file thats having problem, for sure. [code] #include "stdafx.h" #include <iostream> #include<fstream> #include<iomanip> #include<stdlib.h> using namespace std; int main() { char option = '\0', user; cout<< setiosflags(ios::left)<< "\t \t \t UH Visitors Parking "<<endl; cout<< setiosflags(ios::left)<< "_______________________________________________________________"<<endl; cout<<"\n"<<setiosflags(ios::right)<< "\t Help \t Car \t MotorCycle \t SeniorCitizen \t Quit"; cout<<"\n"<<setiosflags(ios::left)<<"_______________________________________________________________"<<endl; cout<<"Please select an …

Member Avatar
+0 forum 10
Member Avatar

Hi everyone, I have worked some more on my code and this time I am getting some error that I am not able to resolve. Please help me. The error says: "initialization skipped by case label." Please show me how to resolve this. Here is the code. The error has a remark in red. [code] // Hw6_Bhasin.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include<fstream> #include<iomanip> #include<stdlib.h> using namespace std; int CarParking(int); int main() { int minutes = 0; char option = '\0', user; ifstream input; ofstream output; cout<< setiosflags(ios::left)<< "\t \t \t …

Member Avatar
+0 forum 5

The End.