3,183 Posted Topics

Member Avatar for ronny22

The questions you've asked are the purpose of the "How would you test a toaster" interview question: [list] [*]Can you think logically through the requirements for the toaster? [*]Can you devise testing steps that put the requirements through their paces? [*]Can you think of plausible edge cases that weren't considered …

Member Avatar for ronny22
0
156
Member Avatar for skannigan

I think the calculations are too complicated. Try this: [code] // Get the total months for full years worked tm = (eyear - syear) * 12; // Remove months not worked from the first year tm -= (smnt - 1); // Add months worked from the last year tm += …

Member Avatar for skannigan
0
164
Member Avatar for arold10

This Daniweb tutorial explains what is happening and how to fix it: [URL="http://www.daniweb.com/software-development/cpp/tutorials/90228"]"Flushing" the input stream[/URL]

Member Avatar for deceptikon
0
122
Member Avatar for shaker naser
Member Avatar for remarkablyso

It took a surprising amount of work to get Dani to put that tiny forum index link at the bottom of every page, so I'll ask what she'll probably ask. Why do you need to get to the index so badly that there has to be an immediate link from …

Member Avatar for deceptikon
0
150
Member Avatar for Diamond3x

[QUOTE]Now i know what is cout for but what is std and what are these "::" for?[/QUOTE] The :: operator is called the scope resolution operator. It's primarily there for accessing names declared in a namespace or class, and std is the C++ library's namespace. std::cout says to look for …

Member Avatar for neartoyou
0
255
Member Avatar for Karlwakim

1) Other. Mostly books, reading code, answering questions about code, and experimenting. 2) Interested. 3) No, I learned C first. 4) Yes, I've learned many languages after C++.

Member Avatar for therockon7throw
0
236
Member Avatar for TechSupportGeek

[QUOTE]The way I see things, constantly calling fact(n - 1) when the method tries to return will result in an infinite amount of times the method being called without returning anything.[/QUOTE] Each call invokes a new instance of the function with new arguments. The effect is as if you did …

Member Avatar for TechSupportGeek
0
195
Member Avatar for rfrapp

Close, don't forget 0. It makes all the difference. :) It's also possible to use a trick with strings and avoid typing out the whole array: [code] char const* hex = "0123456789ABCDEF"; // get the least significant digit in hex char digit = hex[value % 16]; [/code]

Member Avatar for rfrapp
0
3K
Member Avatar for Ahmed2

[QUOTE]did I miss something here??[/QUOTE] There are too many variables named t. There's the global t and the local t in main()'s loop. It's recommended not to use the same name more than once for nested scopes. It's very easy to get confused.

Member Avatar for Ahmed2
0
239
Member Avatar for tischn

[QUOTE]The Programm stops at line 325 - 331[/QUOTE] The array is being indexed with timer0, but the rest of the loop suggests that it should be using timer2. I'd guess that timer0 is out of bounds for the array, which is one of the big causes for a segmentation fault.

Member Avatar for tischn
0
1K
Member Avatar for mike.bauer
Member Avatar for mike.bauer
Member Avatar for rushikesh jadha

[QUOTE]which is the best programming language between java and .net.[/QUOTE] .NET isn't a language, it's a framework. You probably mean Java and C# as they're very similar in terms of syntax, but it's still impossible to compare languages without a very specific context and well defined points of comparison. Just …

Member Avatar for Rashakil Fol
0
191
Member Avatar for Gaiety

If there are more reads than writes, any reads beyond the number of writes will fail. If there are more writes than reads, nothing happens aside from a risk of lost data for the writes that weren't consumed.

Member Avatar for Gaiety
0
187
Member Avatar for Reverend Jim

Only Dani can undo reputation, to the best of my knowledge, as it's not built into the vBulletin interface even for community admins. However, you can negate it by waiting until tomorrow and then applying positive rep to another post. It's not perfect, but at least that would make the …

Member Avatar for deceptikon
0
106
Member Avatar for drico7041

[QUOTE=drico7041;1753322]Do you have to be like a master programmer in a certain language to land a job in this field?[/QUOTE] Of course not. The idea that professional developers are always masters of the craft is a romanticized fantasy that hobbyists dream up. The reality is that only a small fraction …

Member Avatar for WaltP
-1
267
Member Avatar for wildplace

[QUOTE]is there any other function that would including the end line character?[/QUOTE] [code] istream& my_getline(istream& is, string& s) { istream& result = getline(is, s); s.push_back('\n'); return result; } [/code] Presto!

Member Avatar for WaltP
0
121
Member Avatar for tanvirraj91
Member Avatar for fobos

Depending on the topic of your threads, I'd say one of the Microsoft Windows sub-forums or Web Development sub-forums would be the best fit as it stands now. Adding a forum isn't technically a huge deal, but there needs to be sufficient demand first. Otherwise we'd end up with the …

Member Avatar for deceptikon
0
84
Member Avatar for jigglymig

[CODE]template<typename T> Point<T> Point<T>::plus(Point<T> operand2) { Point temp; temp.set_x(get_x() + operand2.get_x()); temp.set_y(get_y() + operand2.get_y()); return temp; }[/CODE]

Member Avatar for jigglymig
0
110
Member Avatar for shanki himanshu

Does the string represent a valid double value? If not, then you won't find a conversion function that works without first getting a library that supports larger floating point values.

Member Avatar for DeanMSands3
0
150
Member Avatar for konon_genius

Nobody is going to do your homework for you. Please read our rules and then ask a specific question about the problem if you need help. And by help, I mean a little help, not giving you the answers.

Member Avatar for deceptikon
-1
139
Member Avatar for boris90

I see a bunch of potential problems, but in my environment the file reads perfectly. I don't want this post to be completely useless to you, so here is a test program that just reads the file and displays the lines in the vector. I fixed the aforementioned potential problems …

Member Avatar for boris90
0
546
Member Avatar for frogboy77

[QUOTE]If you say a post is good or bad, you always have to why.[/QUOTE] Voting is completely anonymous outside of a direct database query, which only Dani presently has access to perform. With the current vBulletin back-end, reputation is not anonymous, but a comment isn't required. As best practice I'd …

Member Avatar for zeroliken
0
104
Member Avatar for tanvirraj91
Member Avatar for tanvirraj91
0
99
Member Avatar for engineerchica

You can initialize present to '\0'. That won't compare equal to whitespace or any of you word boundaries, and it will immediately be reset to whatever the first character is.

Member Avatar for engineerchica
0
463
Member Avatar for npsgaming

I see a few problems with the sorting algorithm: [QUOTE][CODE]int p = o - 1;[/CODE][/QUOTE] When the loop first starts, o is 0, but the next thing the code does is compare values[p] with values[p + 1]. That's the same as saying [ICODE]values[-1] > values[0][/ICODE], which is an out of …

Member Avatar for deceptikon
0
204
Member Avatar for infantheartlyje

What kind of flexibility do you have in the file format? If it doesn't need to be human readable outside of the reading application, you could store records in the insertion order for a binary search tree. That way there's no mucking about with sorting, it all happens naturally through …

Member Avatar for deceptikon
0
237
Member Avatar for badboy11

I think a good question to ask is why do you think you need this behavior? Even in C# it's recommended to avoid ArrayList in favor of the more statically typed generic List<>. C++ isn't designed with a universal Object class that everything derives from, which makes a heterogeneous collection …

Member Avatar for badboy11
0
1K
Member Avatar for n4j

[QUOTE]What's a nod? What's an edge? What's a weight?[/QUOTE] Nod is obviously a typo for node, and all of those terms are well known in graph theory, as is Prim's algorithm. I don't think the OP is expected to explain concepts that should be common knowledge, and I'm assuming you're …

Member Avatar for n4j
0
259
Member Avatar for Jay22

This looks like a normal homework assignment that combines previously learned tasks into a complete application: [list] [*]Generating random numbers [*]File I/O [*]Searching [*]Sorting [/list] The only part that might not have been covered in your class would be computing the CPU time, but that's straightforward. I'll give you that …

Member Avatar for Jay22
0
98
Member Avatar for Gonzo14

Or the less redundant: [code] repeat1 = true; while (repeat1) { cout << "Would you like to add another item? (Y/N): "; cin >> addAnother; repeat1 = (addAnother == 'y' || addAnother == 'Y'); } [/code] Note that I fixed the condition for checking against 'y' or 'Y'. Before it …

Member Avatar for Gonzo14
0
164
Member Avatar for annitaz

Here are the formulae for converting between Fahrenheit and Celsius: Celsius = (5.0 / 9.0) * (Fahrenheit - 32) Fahrenheit = (9.0 / 5.0) * Celsius + 32 Once you have the values for Celsius or Fahrenheit, just plug in the formula at the appropriate place and display the result.

Member Avatar for deceptikon
0
269
Member Avatar for tanvirraj91

C++ isn't an easy language to learn. [URL="http://www.amazon.com/Accelerated-C-Practical-Programming-Example/dp/020170353X"]This book[/URL] is as close to a modern introduction as you'll find, but it's starting to show some age. The new standard came out recently, but I don't know of any books focusing on it yet, much less beginning books.

Member Avatar for jwenting
0
136
Member Avatar for jackbauer24

[QUOTE]As the title says, Python or Ruby?[/QUOTE] In what context? For what purpose? What metrics are you looking to compare? It's impossible to compare languages without a very specific target of comparison. Just asking "which is better?" will get you nothing but useless subjective opinions.

Member Avatar for jackbauer24
0
115
Member Avatar for ohblahitsme

[QUOTE=ohblahitsme;1750312]Thanks for the reply WaltP, but I don't have an .EXE file. I'm running a.out from the terminal in order to execute my program.[/QUOTE] a.out [i]is[/i] the executable file. Look in the same directory as a.out, or the current working directory when you run your program.

Member Avatar for ohblahitsme
0
172
Member Avatar for Shaye12321

How is 'string' defined for this purpose? Technically any text file only has one string, the entire contents of the file. Another common method is reading words where a 'word' is any unbroken sequence of non-whitespace characters.

Member Avatar for WaltP
0
207
Member Avatar for stereomatching

[QUOTE]Those seniors told me the codes have many factors of "history", every line have their "meaning", but when I ask them--those seniors of our company, they know nothing and have not ideas what is wrong with these codes.[/QUOTE] You're treading on dangerous ground. It's very important not to think of …

Member Avatar for stereomatching
0
191
Member Avatar for ram619

When you say [ICODE]ch=i++[s];[/ICODE] it means [ICODE]ch=(i++)[s];[/ICODE], but when you say [ICODE]ch=++i[s];[/ICODE] it means [ICODE]ch=++(i[s]);[/ICODE]. It's totally confusing because intuition says it should be [ICODE]ch=(++i)[s];[/ICODE]. But that's where the '!' is coming from. i is 3 at that point, and the next character after ' ' in ASCII is '!'.

Member Avatar for ram619
0
213
Member Avatar for cloud02

Web design these days is more about dynamic pages than static, so you probably won't just be using HTML and CSS. Using things like Javascript, PHP, ASP, and databases is a lot easier when you have some programming experience. If you can't work with those technologies, you could probably still …

Member Avatar for Rashakil Fol
0
178
Member Avatar for DJSAN10

The standard uses a simpler description: [QUOTE]if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type.[/QUOTE]

Member Avatar for DJSAN10
0
143
Member Avatar for arold10

gallon is used as the loop controller, but you never change its value in the loop body. This is called an infinite loop.

Member Avatar for zeroliken
0
154
Member Avatar for fmasroor

It alternates characters just fine for me, but you can simplify the toggle just by flipping a variable instead of trying to calculate it based on the loop indexes: [code] #include <iostream> #include <windows.h> using namespace std; int main() { HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE); int basecolor1 = FOREGROUND_GREEN | FOREGROUND_INTENSITY; …

Member Avatar for deceptikon
0
154
Member Avatar for charlybones

A busy wait loop will task the CPU while putting the thread to sleep will not. If you need a short sleep to let the connection close completely then Thread.Sleep() is the way to do it.

Member Avatar for charlybones
0
250
Member Avatar for Liuhh00

There's no choice but to use a loop somewhere. You can hide it behind a function, or use a compiler-specific function like strlower(), but there's still a loop.

Member Avatar for deceptikon
0
66
Member Avatar for daldrome

wordCount() is ruining the string for later processing. Always remember that strtok() modifies the string by writing '\0' at appropriate places. What about merging the two tasks of counting words and saving them to the array? [code] #include <iostream> #include <cstring> using namespace std; namespace { const int MAX = …

Member Avatar for deceptikon
0
2K
Member Avatar for noprogn
Member Avatar for cdea06

The only real duplication you have is in printing the too many days error. Any other overcomplication comes from parsing two dates at the same time. I think a better option is a function that parses one date, then call it twice.

Member Avatar for WaltP
0
146
Member Avatar for myk45

The C++ runtime eventually has to call your main(), but there's stuff that needs to be done both before and after. Judging by the name, you're using a Microsoft compiler. If you have the CRT sources then look for crt0.c, it's a small source file that does the runtime initialization.

Member Avatar for deceptikon
0
142

The End.