This is my first program aside from hello world. It is still in progress. I would really like to know how to get a time stamp for the duration of the presentation of each question and the time taken for a response. I would also like to know the best approach to storing responses individually for later review. I am not asking for help in improving the program beyond these items but all constructive criticism is welcome and appreciated. This is not for a class and is for personal use only. There are 72 questions total and I have included the basic structure as including more would be redundant. This is very new to me so the simpler the explanation the better.
The latter part will compare items e and i and if e<i than that person will score introverted which will be divided to give the percent of introverted responses. I do not need help with this part but am unsure if what I am asking for will not require an over hall of the code thus far or can be incorporated into existing code. I am also in agreement that awnser is not a word, but after coping and pasting 71 questions it has become a variable.
Code:
#include <iostream>
#include <string>
int main()
{
using namespace std;
char response[256];
float ei = 0;
float tf = 0;
float ins = 0;
float pj = 0;
int y = 0;
int n = 0;
int i = 0;
int e = 0;
int t = 0;
int f = 0;
int in = 0;
int s = 0;
int p = 0;
int j = 0;
int awnser = 0;
cout <<" This is a personality test commonly called the Jung/Briggs-Meyer\n";
cout <<" personality test. You will be asked questions in which you are required\n";
cout <<" to answer Yes(y) or No(n) as the question applies to you. The answer you\n";
cout <<" give is the one that most applies to you, even if you agree with niether\n";
cout <<" Would you like to take the personality test? select 1 for yes 2 to exit. ";
cin.getline(response,256);
if (strlen(response) == 0) {
cout <<"Please make a selection ";
return 1;
}
while ((atoi(response) < 1) | (atoi(response) > 2)) {
cout <<response<<" - is an invalid selection.";
return 1;
}
if (atoi(response) == 1) {
cout <<" 1. You are alomst never late for your appointments. Y/N ";
cin.getline(response,256);
awnser = atoi(response);
if (awnser == 'y' || 'Y')
y = j++;
else
if (awnser == 'N'|| 'n')
n = p++;
cout <<"2. You like being engaged in an active and fast paced job. Y/N ";
cin.getline(response,256);
awnser = atoi(response);
if (awnser == 'y' || 'Y')
y = e++;
else
if (awnser == 'N'|| 'n')
n = i++;
cout <<"3. You enjoy having a wide circle of acquaintances. Y/N ";
cin.getline(response,256);
awnser = atoi(response);
if (awnser == 'y' || 'Y')
y = e++;
else
if (awnser == 'N'|| 'n')
n = i++;
cout <<"4. You feel involved when watching soaps. Y/N ";
cin.getline(response,256);
awnser = atoi(response);
if (awnser == 'y' || 'Y')
y = f++;
else
if (awnser == 'N'|| 'n')
n = t++;
cout <<"5. You are usually the first to react to an unexpected event:\n";
cout <<" the telephone ringing or unexpected question. Y/N ";
cin.getline(response,256);
awnser = atoi(response);
if (awnser == 'y' || 'Y')
y = e++;
else
if (awnser == 'N'|| 'n')
n = i++;
cout <<"6. You are more interested in a general idea than in the details\n";
cout <<" of its realization. Y/N ";
cin.getline(response,256);
awnser = atoi(response);
if (awnser == 'y' || 'Y')
y = in++;
else
if (awnser == 'N'|| 'n')
n = s++;
cout <<"7. You tend to be unbiased even if this might endanger your good\n";
cout <<" relations with people. Y/N ";
cin.getline(response,256);
awnser = atoi(response);
if (awnser == 'y' || 'Y')
y = t++;
else
if (awnser == 'N'|| 'n')
n = f++;