- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
29 Posted Topics
You may want to have a look here [url]http://www.daniweb.com/forums/thread90228.html[/url]. Here's a snippet you can include at the end of main(), just prior to the return statement. [code="cpp"] // exit routine cout << "\n\n...Press ENTER to Exit System..."; cin.get();[/code] or, if that doesn't work, pressing ENTER and nothing seems to happen, …
Hope someone can clarify. I'm self-studying and my question relates to Programming Exercise # 2, Chapter 12, C++ Primer Plus Fifth Edition (pg. 629). I completed the exercise and achieved the desired result but my query came about when I compared my version to the solution. The exercise builds upon …
I'm self studying from the book, C++ Primer Plus Fifth Edition, by Stephen Prata. The following relates to Chapter 13, Page 699, Programming Exercise #4. One task is to write the derived class method definitions based upon the given prototypes. The following are the said prototypes. [CODE="cpp"]class Port { private: …
In learning Ruby I've dug out some old C++ exercises and one in particular which can be found [URL="http://prime357.net/node/80"]here [/URL]deals with a for loop. I'm basically converting the C++ code to Ruby code. I won't repeat the C++ code but the exercise is as follows: Write a C++ program that …
How do I configure SciTE so that when code ( gets() ) asks for user input I can enter that input via the output console. At present, all that happens is a 'Terminate' button appears in the output console. If the code doesn't contain any keyboard input, then all is …
I dabbled in Ruby quite a while ago but only at the console level. I didn't take it any further at the time. I'm now considering treating it more seriously this time, though I'd have to start from the start. My understanding is that Ruby is a cross-platform development language. …
I'm self studying C++ and I'm actually back-tracking a bit in order to clarify things. My question revolves around why in the following code is the [icode]cin.fail() == true[/icode]. [code="cpp"] #include <iostream> using namespace std; int main() { char getdata; cout << "Enter one character: "; cin >> getdata; cin.get(); …
I've just completed an exercise from a book wherein the task is to display a menu of choices each associated to an alphabetical character. The program is to reject invalid characters and only finishing when a valid choice is made. Below is my solution, it achieves the task but I'd …
I'm self studying from the book, C++ Primer Plus Fifth Edition, by Stephen Prata. The following relates to Chapter 13, Page 699, Programming Exercise #4. One task is to write the derived class method definitions based upon the given prototypes. The following are the said prototypes. [CODE="cpp"]class Port { private: …
[QUOTE=plgriffith;549252]That loop is saying that you are going to start the loop with i initialized to 0, and increment i by 1 for each iteration. You will keep looping as long as i is less than 5. So, the first time through the loop i will be 0, then 1, …
[QUOTE=Jboy05;548316]how about this then [code] double MPG ( double sizeoftank, double number of milest, double gasleftintank) { numberofmilest = numberofmilest/sizeoftank; return numberofmilest; } [/code][/QUOTE] Think of it this way. You have two known pieces of information (gallons used and miles travelled), that is all you know. The third piece is …
[QUOTE=Jboy05;540905]so how do I return 'N' if I don't delcare it?[/QUOTE] There is no need to initialise and declare the return value, in this case. It's returned directly without first assigning it to a variable. If you wanted to, you could initialise and assign to a char variable and then …
What was the culprit?
I'll give you one thing, you've got more front than Myers (substitute 'Myers' for any major department store in your area) but maybe that's just me being cynical. What type of program are you looking for? For somebody completely new to C++ (as you mention here [url]http://www.daniweb.com/forums/thread106805.html[/url]) this particular assignment …
I'm not really following the point of this thread. I can't see what the problem is. (other than a cranky professor) At the end of the day, you have to hand in your assignment and no doubt it's the source code that's handed in. Isn't it the source code, which …
I'm learning C++ from C++ Primer Plus, 5th Edition, and have come across the following problem. The following class declaration is given as part of the question: [code="cpp"] /* Name: move.h Copyright: Author: Steven Taylor Date: 31/01/08 15:05 Description: Class 'Move' header file. C++ Primer Plus, Ch.10,Prog. Ex 6. */ …
It seems like this is an ambitious project or assignment for someone who doesn't understand the basics of classes. I would have thought your class (as in school) would have eased you into this and therefore this particular assignment being a logical extension to what you have already been taught/learnt. …
[QUOTE=tamereth;520182]Yes, I realize using char arrays is terrible, but those were assignment requirements. Thanks to everyone who replied, but I've got it working now.[/QUOTE] What did you do to resolve the problem?
eesti44 it appears we're working from the same book, C++ Primer Plus, 5th Edition, and at the same chapter doing the programming examples. I've just completed this particular exercise and it gave me no end of grief. As another poster has mentioned the header file from the book is missing …
Hope someone can help. I'm self-studying from C++ Primer Plus, 5th Edition. I'm having trouble working out why the following two files will not compile. I'm using Dev-C++, under Windows Vista. [code="cpp"] /* Name: bankaccount.h Copyright: Author: Steven Taylor Date: 28/01/08 14:04 Description: C++ Primer Plus, Chapter 10, Programming Exercise. …
[QUOTE=jonathanasdf;518195]Never mind. That question was solved by myself. anyhow, when I compile my code, I get an error. [CODE] #include <iostream> #include <windows.h> using namespace std; int main(){ for (int number=1; number<=6; number++;){ if (number == 1){ numbersuffix = "st";} else if (number == 2){ numbersuffix = "nd";} else if …
[QUOTE=guitarrick;512708] The whole focus of this chapter was to implement loops. I just don't see how to utilize the loop with a conditional which will only increment a given input every 5. Previously, Salem gave me this, and I don't know what the mod does here (Thanks for any and …
[QUOTE=bis student;500122]before every thing thank you for helping , and Im asking if these answer is right : [CODE]# include <iostream> using namespace std ; int main () { int alpha[50]; for (int i=0;i<25;i++) { alpha[i]=i*i; cout<<alpha[i]<<" "; for(i=25;i<50;i++) { alpha[i]=3*i; cout<<alpha[i]<<" "; } return 0 }[/CODE] also I have …
You may want to check out this [url]http://www.ultimatepp.org/[/url]. It seems to have the VB style of putting an application together. I haven't tested it yet as I'm still in the process of getting a handle on C++ basics, command line stuff, before I delve into GUI.
I think this is the right forum for this type of question as opposed to the C++ forum. I'm learning C++ via Windows Vista, console stuff, at the moment. I've also got Ubunto installed and trying to figure out which programs I need in order to write simple console type …
A programming exercise I'm doing requires that a program be written whereby functions are used to 1) fill an array, 2) show the array and 3) alter the data of the array. The arrays are to be passed as pointers to the functions and the use of [icode]const[/icode] keyword be …
[CODE="cpp"]// strgback.cpp -- a function that returns a pointer to char // C++ Primer Plus, Fifth Edition // Chapter 7, Page 312. // Listing 7.10 // 10 Dec, 2007. #include <iostream> char * buildstr(char c, int n); // prototype int main() { using namespace std; int times; char ch; cout …
So, here is my first post. I'm currently learning C++ and into my 2nd week of self-study. I'm using the book, C++ Primer Plus, Fifth Edition, as my primary source and constantly referring back to other books and the web for a different take on particular aspects. It's the 'different …
The End.