bubblegum.cpp

The times they are a-changin’.

This post seems to be older than 18 years—a long time on the internet. It might be outdated.

Here’s last weeks project:

//Name: Andrew Ferguson
//Date: 1/19/2005
//Purpose: To split up bubble gum
#include <conio.h>
#include <iostream>
#include <stdio.h>

using namespace std;

int sticks, people, sticks_person, sticks_remain;

char n;

int main()
{
	cout << "How many sticks of gum do you have?n";
	cin >> sticks;
	cout << "How many people are in MACS 261C?n";
	cin >> people;
	sticks_person = sticks/people;
	sticks_remain = sticks%people;
	cout << "Every person can receive " << sticks_person << ".n";
	cout << "There are " << sticks_remain << " left over.n";

    printf("Press any key to continue...");
    n = getch();

	return 0;
}

Download the compiled executible

0