Hi there,
I'm trying to write a program which calculates the average mark of three tests but I can't figure out how to do the basic math, I know this sounds stupid but I can't seem to find any examples anywhere.
Code:
#include <iostream>
using namespace std;
int main()
{
int pass = 15;
int french, german, spanish;
int mark = (french+german+spanish)/3;
cout<<"LANGUAGE COURSE\n";
cout<<"\n";
cout<<"Enter French mark."; // I don't need the cursor to move
cin>> french; // down.
cin.ignore();
cout<<"Enter German mark.";
cin>> german;
cin.ignore();
cout<<"Enter Spanish mark.";
cin>> spanish;
cin.ignore();
cout<<"Your percentage mark was "<< mark <<".\n";
cin.get();
}
It compiles and runs but when I enter for example 21 for french, 18 for german and 13 for spanish it displays the average 697034459.
i have never done maths in c++ before and I can't find any relevant help anywhere so any links or other help will be very welcome.
Calef13