- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Hi, I have two classes in two separate .cpp files. I obtain a string using cin and then I need to use this string in a method in a separate class. If that makes sense.. [CODE]class HomePage{ static void HsubmitChangeDutyRequests(string) { Duties::submitChangeDutyRequests(string);} }[/CODE] [CODE]class Duties{ static void submitChangeDutyRequests(string); }[/CODE] This … |
|
Hi I am trying to assign 5 people various objectives between day0 and day13. However the output is not correct and goes fuzzy in the second half of the output. This is my code: [CODE]for(int x=1, y=0; y < 5, x < 15; x++, y++) { array[x][y] = objectives[y]; if … |
|
This is my code: [CODE] stringstream str_number string description while(!str_number.eof()) { str_number >> str_description; if (str_description.length() < 1) { break; } description = description +" "+ str_description; }[/CODE] My problem is that if the description is more than one string, the last string is repeated twice. For example if the … |
|
This is my code: [CODE] for (i = 0; i < date.size(); i++) { str_date << date[i]; str_date >> newDay; str_date >> newMonth; str_date >> newYear; apptDay.push_back(newDay); apptMonth.push_back(intMonth); apptYear.push_back(newYear); }[/CODE] My problem is that the first date[1] gets saved nicely, however the second round of the loop it all goes … |
|
I am trying to sort a vector of strings in order (one line consists of various strings e.g. 12 10 2010) and was wondering if I would be able to extract individual values from one line of a vector? The way I am doing this is by reading lines from … |
|
This doesnt work as it should... [CODE]void renameMonths(string month) { if (month == "jan") { month = "january"; } } int main() { string month; month = "jan"; renameMonths(month); cout << month << endl; }[/CODE] the output is just jan, when it should be january. Thanks in advance. |
|
This is my code: [CODE] void removeAppointments() { vector <string> newfile; string line; int i; int n; ifstream Appointments; ofstream newAppointments; Appointments.open(DATAFILE); newAppointments.open(newDATAFILE); if (Appointments.is_open() && newAppointments.is_open()) { // Read the file until it's finished, displaying lines as we go. while (!Appointments.eof()) { getline(Appointments, line, '\n'); // getline reads a … |
|
I am making a program (new to c++) which lets you save contacts and then allow you to list them and remove them. I am lost to how I would number each contact, for example: 1. Sam 21340223 2. Jessica 21020303 |
|
When I want to access a part of the vector (appointment) it won't allow it, for example simply adding: [CODE]cout << appointment[1];[/CODE] will not work. I also want this vector to be saved to my class (Appointment), so I can later remove elements of the vector. Would I be able … |
|
I am trying to add a numbering system to a list in a datafile: [CODE] Appointments.open(DATAFILE); if (Appointments.is_open()) { // Read the file until it's finished, displaying lines as we go. while (!Appointments.eof()) { getline(Appointments, line, '\n'); // getline reads a line at a time appointment.push_back(line); cout << i << … |
|
Hi, I'm studying Mechatronics engineering in my 2nd year and I'm doing a software design paper... so here I am :D You guys have been so much help so far its the best community I've ever seen! |