Credit cards make it easy to buy whatever you need (or want!) without having to carry cash with the associated risks of losing it or having it stolen. They are also convenient because the precise sum makes little difference - you can sign a chit for $50.00 just as easily as $53.17 so there's less need to fiddle with change. You also get reward points, cash back etc.
From the merchant's perspective credit cards can be handy because you don't have to fuss with change, don't have to accumulate cash and get it to the bank (with enhanced risks of people targeting you to steal the cash). Credit cards make it easy for people to make large purchases - most people don't carry substantial amounts of cash so if you don't take cards you'll probably lose out on larger sales and definitely lose out on larger impulse purchases.
Cash has the advantage that it helps you control what you spend, which is good for consumers but not so good for merchants. Spending cash also stops the banks siphoning endless slices of the transaction in fees, although if the bank charges the merchant to count and deposit cash it doesn't help them as much.
Cash also keeps your spending habits private. Cards keep a record and the card issuer knows where you shop.
I'd be interested to know what, if any, difference it makes to tipped workers when people use cash or cards. With a card you can just click the percentage you want to tip on the screen and everything else is automatic. Tipping cash seems like the kind of situation where people might just round up the check. If the total including the diner's preferred tip percentage comes to, say, $52.78 I wonder how many people would round to $50, 52, 53 or 55.