Please Help

Hello everyone, me and my friend just finished writing up this code with some help from our professor. We fixed some of the errors but it still wont start up, I'm using Microsoft visual C++ to run the program.
Well we hit a dead end and are struggling if anyone can help us that would be much appreciated!
Please and thank you.

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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
 //Author: Main Answer

#include <iostream>
#include <string>

using namespace std;

//Prototypes which hold the function of encrypt and decrypt
void encrypt(string x);
void decrypt(string x);

int main(){

    //Variable needed to store user's input
    string input0;
    string input1;

    //Prompt the user to input a message and then calls the ecryption function
    cout << "Enter Your Message: ";
    getline(cin,input0);
    encrypt(input0);

    //You can guess lol
    cout << endl;

    //Prompt the user to input the code and then calls the decryption function to convert back to message
    cout << "Enter the code: ";
    getline(cin,input1);
    decrypt(input1);

}

//The encryption function itself
void encrypt(string x){

    //Variables meant to store the asking number and the individual character (Max 128)
    int ascii[128];
    string code[128];

    //Variables meant to dynamically enhance the asking numbers and to keep track of loop for reset
    int j = 1;
    int t = 0;

    //Loop for enhancing the asking numbers
    for(unsigned int i = 0; i < x.length(); i++){
        ascii[i] = static_cast<int>(x[i]) + j;
        j++;
        t++;
        if(t == 16 ){
            j = 1;
            t = 0;
        }
    }

    //Loop for converting the asking numbers to characters
    for(unsigned int i = 0 ; i < x.length(); i++){
        code[i] = static_cast<char>(ascii[i]);
        cout << code[i];
    }
    cout << endl;
}

//The decryption function itself
void decrypt(string x){

    //Variables meant to store the enchance asking number and the individual character (Max 128)
    int Eascii[128];
    string code[128];

    //Variables meant to dynamically enhance the asking numbers and to keep track of loop for reset
    int j = 1;
    int t = 0;

    //Loop for reversing the enhance asking numbers
    for(unsigned int i = 0; i < x.length(); i++){
        Eascii[i] = static_cast<int>(x[i]) - j;
        j++;
        t++;
        if(t == 16 ){
            j = 1;
            t = 0;
        }
    }

    //Loop for converting the asking numbers to characters
    for(unsigned int i = 0 ; i < x.length(); i++){
        code[i] = static_cast<char>(Eascii[i]);
        cout << code[i];
    }
    cout << endl;
}
This code runs, I've copy, pasted and confirmed that. If you are using MSVS then don't you need to include that "stdafx.h" header? If not, then what error is it throwing back at you?
Thank you for replying but apparently it was the computer we were on. It gave us a strange error, the program works now thank you for responding!
Topic archived. No new replies allowed.