This Programs is a Simple Calculator that usses Arrays and pointers.
Currently a freshman student and im completely lost on the errors i keep on getting

``````#include<stdio.h>
#include <conio.h>

main()
{
clrscr();

int num1[5],num2[5],sum[5],*n1,*n2,x;
char oper[4],*o;
*n1 =num1[5];
*n2 =num2[5]
*o = oper[4];
oper[0] ='*';
oper[1] ='+';
oper[2] ='-';
oper[3] ='/';

gotoxy(3,1);printf("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ");
gotoxy(3,2);printf("");
gotoxy(3,4);printf("           _____   _____   _____ = _____   ");
gotoxy(3,6);printf("           _____   _____   _____ = _____   ");
gotoxy(3,8);printf("           _____   _____   _____ = _____   ");
gotoxy(3,10);printf("          _____   _____   _____ = _____   ");
gotoxy(3,12);printf("          _____   _____   _____ = _____   ");
gotoxy(3,19);printf("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ");

{
{
x = 4;
if(*o=='+');
gotoxy(3,x);printf("%d\t%c\t%d\t%d",*n1,*o,*n2,sum);
sum =*n1 + *n2;
if(*o=='/');
gotoxy(3,x);printf("%d\t%c\t%d\t%d",*n1,*o,*n2,sum);
sum =*n1 / *n2;
if(*o=='*');
gotoxy(3,x);printf("%d\t%c\t%d\t%d",*n1,*o,*n2,sum);
sum =*n1 * *n2;
if(*o=='-');
gotoxy(3,x);printf("%d\t%c\t%d\t%d",*n1,*o,*n2,sum);
sum =*n1 - *n2;
if(*o=='+');
*n1++;
*n2++;
x++;
else();
printf("\n\nERROR");
}

getch();
return 0;
}
}
``````

Edited by deceptikon: Fixed formatting

2
Contributors
1
55
Views
4 Years
Discussion Span
Last Post by cproger

Are you using an apple computer? If you are than this is an error.

``````2:10: fatal error: 'conio.h' file not found
#include <conio.h>
``````

I'm sorry if I didn't help that much.

Edited by cproger: not good

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.