…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
… <cstdio> using namespace std; //Function Prototype Declaration int next… Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
…{ if (value <= 0) break; std::cout << value <…" "; value = next(value); } std::cout << "count…<< count << std::endl; } Reply by nullptr
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
…> #include <vector> using namespace std; //Function Prototype Declaration int… Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
… <iostream> using namespace std; //Function Prototype Declaration int next… Reply by AssertNull
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
…> #include <vector> using namespace std; //Function Prototype Declaration int… Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
… <cstdio> using namespace std; //Function Prototype Declaration int next… Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
And you can actually take out the `if(n <=1)` guard above. It has no effect. The while loop below it handles it. Reply by AssertNull
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
Although it's true that you can omit the guard, I would argue for leaving it in. When you're reading a recursive method the first question is (how) does it Terminate? I would be very happy to see that right up front. For me readability trumps efficiency … Reply by JamesCherrill
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
The professor doesn't like to see the starting parameters change value in the function (same with the noncomment lines requirement). I'm not sure if this is a real world thing, but thats what he wants. I'm still trying to wrap my head around it. I was … Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
Yes, in the past I have seen style guides and standards that deprecate re-using parameter variables,even if the language allows it. I don't know the reason, but maybe its to avoid confusing less-skilled programmers who may think that void fn(int a)… Reply by JamesCherrill
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
> I'm not sure if this is a real world thing If "real world" means "professional C++ programmers", no. > but thats what he wants. What the professor wants, the professor gets! > I'm still trying to wrap my head … Reply by AssertNull
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
Appreciat the advice everyone. I'll keep the information in mind. Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
@AssertNull I remember you pointing out that when you inputted a certain value, that the last function in my program would give you an incorrect number. I'm not sure what is going on here to the point that occurs for certain number, but not all. It has … Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
Can 't think of why you'd have no issues in Code Blocks. Try entering 2. You get good results from initialcomp_Num? Reply by AssertNull
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
When entered 9, I got a huge number at the end. I was able to see in noMachine this error: g++ -Wall -Wshadow -Wuninitialized -O -o hailstone hailstone.cpp hailstone.cpp: In function ‘int initialcomp_Num(int)’: hailstone.cpp:163:25: … Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
So I gave topValue and initial value of 0. Now the problem seems to be the if statement in the for loop. I have to figure out what to do with the topValue if the initial and cal are equal to one another. The previous function was way easier to deal with. Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
I figured it out. Also, is there a limit to accuracy of the sequence? Reply by Sherwin_4
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
Glad you figured it out. To go back to my earlier tips way back... > Every time you assign a new value to top, assign the value that resulted in the sequence of length top to start. Key word is "Every" from "Every time". … Reply by AssertNull
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
> If there are no bugs in your code, it will work everywhere. True for many modern languages, but not C++. C++ suffers from "undefined behaviour" - code situations that the language definition deliberately says are legal but whose … Reply by JamesCherrill
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
I generally take the view that if I code something in a way that can result in "undefined behavior", I have a "bug", though definitions of "bug" vary. Whether C++ "suffers" from undefined behavior or whether that's … Reply by AssertNull
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
Yes, Java is pretty strict on making sure you have initialised variables - and the logic analysis it does to confirm that is pretty sophisticated, but in the end it goes for safety. "No surprises at run time" is a fundamental desire behind Java's… Reply by JamesCherrill
2 Months Ago
…> #include <vector> using namespace std; //Function Variable Declaration. int… Discussion Thread by Sherwin_4 in Programming
c++
LOL understood @JamesCherrill Reply by Sherwin_4
2 Months Ago
… through array of strings or vector under double quotes and want… <sstream> using namespace std; string GetStdoutFromCommand(string cmd) { string… Discussion Thread by can-mohan in Software Development
2 Months Ago
…define DESCRIPT 2937060 using namespace std; using namespace cv; using…//Classification data vector< float> descriptorsValues; //vector to Mat … Loaded" << std::endl; float result = svm… Discussion Thread by tom_22 in Software Development
c++
1 Month Ago
…define DESCRIPT 2937060 using namespace std; using namespace cv; using…//Classification data vector< float> descriptorsValues; //vector to Mat … Loaded" << std::endl; float result = svm… Discussion Thread by tom_22 in Software Development
c++
I can't offer much here. So I began with a SVM primer at http://www.cs.columbia.edu/~kathy/cs4701/documents/jason_svm_tutorial.pdf At the end of the tutorial I see the link and a google like https://www.google.com/search?q=www.kernel-machines.org&ie=… Reply by rproffitt
1 Month Ago
…;Main.h" using namespace std; struct RepairList { int repairCode[12… Discussion Thread by Dick_2 in Programming
…each line. This way a `vector<RepairType>` will give… Reading the values into the vector becomes fairly simple then: struct… = 0; string part = ""; }; vector<RepairType> repairTypes; void… Reply by tinstaafl
1 Month Ago
…iomanip> using namespace std; void write(int n,…va_start(vargs, n-1); vector<char> sepcifier; …push_back(xarg); } va_end(vargs); //vector to store what's in… Discussion Thread by Mirty in Software Development
c++
2 Weeks Ago
…iomanip> using namespace std; void write(int n,…va_start(vargs, n-1); vector<char> sepcifier; …push_back(xarg); } va_end(vargs); //vector to store what's in… Discussion Thread by Mirty in Software Development
c++
Try debugging this. In Visual C++ (free ones out there) I can set breakpoints to see what vars are at that point. If not, I add print statements to trace my code. This looks like a class assignment. Haven't they covered beginner's debugging? Reply by rproffitt
2 Weeks Ago
…iomanip> using namespace std; void write(int n,…va_start(vargs, n-1); vector<char> sepcifier; …push_back(xarg); } va_end(vargs); //vector to store what's in… Discussion Thread by Mirty in Software Development
c++
> write(2, "Fixed point: {0:f}", 50.0); You're trying to find the integer value between 'f' and '}', correct? In this case, there is none, so that value should be 0, correct? > write(2, "Fixed point: {0:f3}", 50.0); And … Reply by AssertNull
2 Weeks Ago
very new to c++ . have an assignment when am to input some information about an item and write to a file . Have succesfully done that but now i i dont know how to delete a line of entry from the text file and save it . look at so many ways the one method… Discussion Thread by John_159 in Software Development
c++
… the entire file into a vector 2. delete that file 3… that isn't required. Use std::getline() in a loop to… Reply by Nihar_2
6 Days Ago