Code:
#include "stdafx.h"
#include <fstream.h>
#include <iostream.h>
#include <iomanip.h>
#include <afx.h>
#include <cstring>
#include <stdlib.h>
int x, y, z;
char varnames [ ] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','x','y','z' };
char varvalues[ 27 ];
void takein(char var){
while(var != varnames[x]){
x++;
cin>>varvalues[x];}
}
void display (char var)
{
x = 0;
while(var != varnames[x]){
x++;
cout<<varvalues[x];}
}
void addition(char v1, char v2, char v3)
{
x = 0;
while (v1 != varnames[x]){
x++;
y = 0;}
while (v2 != varnames[y]){
y++;
z = 0;}
while (v3 != varnames[z]){
z++;
varvalues[z] = varvalues[x] + varvalues[y];
}
}
void subtraction(char v1, char v2, char v3)
{
x = 0;
while (v1 != varnames[x]){
x++;
y = 0;}
while (v2 != varnames[y]){
y++;
z = 0;
}
while (v3 != varnames[z]){
z++;
varvalues[z] = varvalues[x] - varvalues[y];
}
}
void multiply(char v1, char v2, char v3)
{
x = 0;
while (v1 != varnames[x]){
x++;
y = 0;}
while (v2 != varnames[y]){
y++;
z = 0;}
while (v3 != varnames[z]){
z++;
varvalues[z] = varvalues[x] * varvalues[y];
}
}
void divide(char v1, char v2, char v3)
{
x = 0;
while (v1 != varnames[x]){
x++;
y = 0;}
while (v2 != varnames[y]){
y++;
z = 0;}
while (v3 != varnames[z])
{
z++;
varvalues[z] = varvalues[x] / varvalues[y];}
}
void main()
{
ifstream file("a:\file.txt", ios::infile.txt");
for (int i= 0; i < 40;++i)
{
file.getline(file[i],';')
}
fin.close();
while (varvalues[x] != " "){
word += file[ x += 1 ]
if(word == "cin")
takein(file[ x += 1])
if(word == "cout")
display(file [ x += 1 ]
if(word == "addition")
addition(file [ x += 1 ], file[ x +=2 ], file [ x += 2 ])
if(word == "multiply")
multiply(file [ x += 1 ], file [ x += 2 ], file [ x +=2 ])
if( word == "subtraction")
subtraction( file[ x += 1 ], file [ x += 2 ], file [ x +=2 ])
if( word == "divide")
divide (file [ x += 1 ], file [ x += 2 ], file [ x +=2 ])}
}