Dividing it into functions

Here is my code that is kind of like a calculator that takes in the users description and amount and it keeps adding the amount until the user wants to stop.

This is a working code however now I have to divide it into functions. But I'm confused how I would approach that. Any tips would be nice. :D

#include <cstdlib>
#include <iostream>
using namespace std;
struct calc {
char description[20];
float amout;


int main ()
calc inventory[100];
int count=0;
char rerun;
float total=0;
float subtotal=0;

cout<<"Please enter the DESCRIPTION: ";

cout<<"Please enter the Amount: ";

subtotal += inventory[count].amout;
cout<<"The subtotal is: "<<subtotal<<endl;

cout<<"Would you like to add more transactions?(N or Y) ";
while (rerun == 'Y' || rerun == 'y');

total += subtotal;
cout<<"The total is: "<<total<<endl;

return 0;

just make a function

void add()

then prototype it, and call it when you want to use it.
I'm trying to divide this code into 3 functions.
Topic archived. No new replies allowed.