Should I write "cost-benefit" (hyphen) or "cost–benefit" (en dash), and why?
Formally, hyphens are for joining terms, and en dashes are for ranges and distinctions. En dashes have a secondary application joining terms that are already hyphenated or contain spaces, but that doesn't apply here. In this situation I would use an en dash or a slash. Of course, if you do write it with a hyphen, nobody is going to be confused.
Technically, cost–benefit analysis can be interpreted as either [cost–benefit] analysis—an analysis of costs versus benefits—or cost–[benefit analysis]—costs versus an analysis of benefits. Luckily, the latter doesn't make any sense and would really only arise from deliberate pedantic misinterpretation.
Nobody here has nailed it. Here's the answer:
In the construction "Pre–Civil War," the en-dash is correct because it modifies both "civil" and "war." What the OP is wondering is whether this idea carries over to "cost-benefit ratio" and of course you can see that it doesn't, because "benefit ratio" is not a compound term.
This is a very arcane bit of typesetting knowledge, and you'll see it observed only in the highest-end publications like New York Review of Books and The Economist.
There isn't a definitive single answer. The distinction between hyphens and en dashes has more to do with typesetting rules than usage.
In my experience, then, a hyphen is the sensible choice for uniting two words into a compound form. I don't actually have an en dash on my keyboard, and trying to signify one with a double dash makes matters worse. The word processing program you use may impose what it thinks is correct. I have not noticed what mine does.