Hi,
I am a student taking an Intro C programming course and I need help! My assignment is below. I have written the code to best of my ability and it even seems to compile fine, but when I enter numbers into the calculator the whole thing crashes. I have no idea why or even how to go about figuring it out. My "crash" error is at the bottom of the page... Please help me!
My Assignment:
http://calpyso-poet.com/assignment.bmp
My Code:
Code:
// Homework 4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int main (void)
{
float accumulator, value;
char op;
printf ("Enter number.\n");
do {
scanf_s ("%f %c", &value, &op);
switch (op)
{
case 's':
accumulator = value; break;
case '+':
accumulator = accumulator + value; break;
case '-':
accumulator = accumulator - value; break;
case '*':
accumulator = accumulator * value; break;
case '/':
if ( value == 0 )
printf ("Divison by zero does not compute.\n");
else
accumulator = accumulator / value; break;
}
} while (op != 'e' );
return 0;
}
My Error:
http://calpyso-poet.com/error.bmp