Answer to Question #116806 in C++ for hamza

Question #116806
A drink costs 2 dollars. A taco costs 3 dollars. Write a program that given the number of each, compute total cost and assign totalCost with the result. Ex: 4 drinks and 6 tacos yields totalCost of 26. Read inputs from user.
1
Expert's answer
2020-05-18T17:03:46-0400
#include <iostream>
#include <bits/stdc++.h>




using namespace std;


int main(){
    
    int drinks,tacos;
    cout<<"Print Number Of Drinks: ";
    cin>>drinks;
    cout<<"Print Number Of Tacos: ";
    cin>>tacos;
    int totalCost = 2*drinks+3*tacos;
    cout<<"Total Cost: "<<totalCost<<"$"<<endl;
   
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS