Run alternate script

I was just wondering how would I make main which is going to be the entire critical system run crit_dmg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

int main()
{
    int attack, critical_stat;
    
    cout << "Input Attack stat" << endl;
    cin >> attack;
    
    cout << "Input critical stat" << endl;
    cin >> critical_stat;
    
    
    return 0;
}

int crit_dmg()
{
    srand(time(NULL));
    int attack, attack2, bonus, total;
    
    cin >> attack;
    
    attack2 = attack / 2;
    
    bonus = rand() % attack + attack2;
    
    total = (attack + bonus);
    cout << total << endl;
    
    return 0;
}


Any help at all is greatly appreciated

edit 1: I had just realised I declared an integer that I didn't use at all so I removed it just now
Last edited on
crit_dmg();

This is referred to as "calling a function".
http://www.cplusplus.com/doc/tutorial/functions/
Thank you my problem is solved its because of people like you why I love forums like this
Last edited on
Topic archived. No new replies allowed.