#include <iostream>
using namespace std; int main( ) { int numberOfItems, count, caloriesForItem, totalCalories; cout << "How many items did you eat today? "; cin >> numberOfItems; totalCalories = 0; count = 1; cout << "Enter the number of calories in each of the\n" << numberOfItems << " items eaten:\n"; while (count++ <= numberOfItems) { cin >> caloriesForItem; totalCalories = totalCalories + caloriesForItem; } cout << "Total calories eaten today = " << totalCalories << endl; return 0; } |
Navid Plus is a Tech blog focusing on Science material that I learn day through my College and job. Most likely, blog posts contain C++ Programming, Security, Networking, and Math. Let's have some fun.
Monday, March 13, 2017
C++ Part 22
While loop Example:
Subscribe to:
Post Comments (Atom)
Digital Design Part 3
4th→ assembler translates it to the machine language. 1.6 [20] <§1.6> Consider two diļ¬erent implementations of the same instru...
-
An array is used to process a collection of data all of which is of the same type, such as a list of numbers or a list of names. An array...
-
One way to think about execution time is that it equals the number of instructions executed multiplied by the average time per instruc...
No comments:
Post a Comment