75 Posted Topics

Member Avatar for akase2010

cout << Accelerate(first) << endl; The cout implies that you want to output something using the function, Accelerate. The function Accelerate, when you called it Accelerate(first), does not take any parameters in the declared or defined function. Nor does it imply outputting any data either. [CODE] void Car::Accelerate(){ Speed = …

Member Avatar for akase2010
0
141
Member Avatar for iamthesgt
Member Avatar for wondernaet

[CODE] #include <iostream> #include <string> using namespace std; void daysOfChristmas (int days, char switcher, string b[12]){ (days > 0 && switcher == 'y') ? daysOfChristmas(days - 1, 'y', b): false; if (days > 0) { daysOfChristmas(days - 1, 'n', b); cout << "on the " << days << " day …

Member Avatar for VernonDozier
0
115
Member Avatar for iamthesgt

I copied and pasted what you had. The only solution I came up after compiling with no errors is: #include<vector> in the header file Oh, and get rid of std:: in std::vector<int> v1; So its just vector<int> v1;

Member Avatar for iamthesgt
0
287
Member Avatar for declna0872

First, do what jonsca suggested by creating a new variable, adding to the variable of the current grade to get a running total of all grades added together, then divide by NUM_SCORES (sum)/NUM_SCORES will give you your average. To extend on that, you will need to add an additional for-loop …

Member Avatar for Saith
0
2K
Member Avatar for Rimojenkins

OH I see check your IF STATEMENT.. GET RID OF THE ; if(begllts <= intarray[m] && intarray[m] <= endllts); //<--- that last ;, Get rid of it BAD, NEWBIE BAD .. :D

Member Avatar for Saith
0
122
Member Avatar for DaniwebOS

You don't need to have the data type when calling your function in the main() function. [CODE] int main() { //called functions userData(string studentName, int numOfClasses, char letterGrade); calData(int totalPoints, int numOfClasses); displayData(string studentName,char letterGrade, double gpa); getch(); return 0; } [/CODE] You also need to initialize totalPoints to zero …

Member Avatar for DaniwebOS
0
131
Member Avatar for petero_l

You also may want to make functions for each of the cases. [CODE] case '1': first_function(Parameter_list); break; case '2': second_function(Parameter_list); break; default: break; } void first_function(Parameter_list){ <code> } void second_function(Parameter_list){ <code> } [/CODE] makes it cleaner, you can also use this code outside of the switch statement.

Member Avatar for petero_l
0
253
Member Avatar for Mayank23

call the function multiple times. If you are reading the input from a file, you can run a while loop that checks for EOF. If you are reading from user input, make a sentinel to end the while loop. while(string_name != "Done"){ // or change the string to whatever you …

Member Avatar for Mayank23
0
171
Member Avatar for sosongetsu

The nested for loop is what you are looking for. You will use nested for loops once you get into array of arrays. [CODE] void buildSquare( int length, char symbol){ // Length = Length x Length to make the box // Symbol will be used to make the box // …

Member Avatar for sosongetsu
0
194
Member Avatar for HeartBalloon

As Nandomo suggested, you need to use strncpy. You are using the char arrays as C strings, and as such, they use a different method than normal char arrays, or even strings. It would be easier if you just changed all the types (chars) to string. So you'd have [CODE] …

Member Avatar for Nandomo
0
147
Member Avatar for moreautemps

Good luck trying to contact Mr. Bill for that answer. I suggest googling it. As I just did, [url]http://www.makeuseof.com/tag/5-ways-to-make-your-own-screensavers-windows/[/url] Question? How is this related to C++? If you have any program that you would like use to look at, I know I would be interested in seeing any progress you've …

Member Avatar for moreautemps
0
116
Member Avatar for kotddanny

This is what I ended up writing. [CODE] #include <cstdlib> #include <iostream> using namespace std; void compare(int problem[], int SIZE); int main(){ . . . . /* I placed this following section at the very end of your program, between the last else statement and your system pause. */ int …

Member Avatar for kotddanny
0
134
Member Avatar for icasta13

Glad you got the answer :D I would suggest you use the following whenever you use a file for data. It may help with an immediate solution that would otherwise be directly hidden from you. [CODE] ifstream fin; fin.open ("1.txt"); if(fin.fail() ){ cout << "Input file failed to open.\n"; exit(1); …

Member Avatar for icasta13
0
219
Member Avatar for Badoodhi
Re: C++

Please show us what you have done so far. Paste in some code, show some work, and we can then help you.

Member Avatar for alexchen
-5
118
Member Avatar for Mr_PoP

You also may want to read up on strings and string input, from what I read from multiple other sources, you want to be using the standalone function getline(cin, npcname) vs the regular cin >> input. Mixing cin >> with strings may give some funky results.

Member Avatar for Saith
0
80
Member Avatar for jlianne18

This is what I ended up coming up with. First you want to make sure you can open your file. If you cannot open your file, your arrays will automatically be filled with junk. That may be half of your problem. After that, I just used cout << as a …

Member Avatar for Saith
0
203
Member Avatar for Mr_PoP

This is what I came up with. The code works for any valid input from 1 - 9. You can change the range from a number higher than 9 or lower than 1. [CODE] #include<iostream> using namespace std; int main(){ int number; cout << "Please input a number 1 - …

Member Avatar for Mr_PoP
0
146
Member Avatar for icasta13

Seem like your coding structure is a little off, perhaps something like this? This is just a snippet of what I just wrote, but I did write the entire program to make sure the snippets work properly. The output seems correct with the desired input in the array. I won't …

Member Avatar for icasta13
0
275
Member Avatar for indr

The question is why you would want to know the exact location of variable char a. It's useless as when the variable is initialized with the onset of the program, the variable will be in a different memory location. Hence, hard coding memory locations will be meaningless. [CODE] #include<iostream> using …

Member Avatar for embooglement
0
152
Member Avatar for staz
Member Avatar for Kanoisa

I just started back into C++ from taking some time off from it as well, slight rusty, but let's see if I can give you a shot at what you are asking for. class FullOfFunctions{ public: void function(int happy_num); //pass by value void function2(int & happy_num); //pass by reference private: …

Member Avatar for Kanoisa
0
167
Member Avatar for jackmaverick1

Instead of having the user input a statement, have the program ask a question and the user reply with yes or no. At which point, if the answer is yes, you lead down one road of possibilities to what the answer is. Otherwise, head the other direction. Having the user …

Member Avatar for JSPMA1988
0
161
Member Avatar for jackmaverick1

#include <string> You can assign value by, int main() { string name; name = "This is a string. Don't forget to use double quotes instead of single!"; cout << name; Output: This is a string. Don't forget to use double quotes instead of single! This string class has a lot …

Member Avatar for Saith
0
135
Member Avatar for zit1343

Just a quick note. What you had earlier, char name; is the same as char name[1]; // variable holding 1 character // They changed it to 30, char name[30]; // so that any input you enter will have enough space to be saved to the variable "name".

Member Avatar for Saith
0
152

The End.