someone tell me whats wrong with my code

// prac.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}

float h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,
h12,h13,h14,h15,h16,h17,h18;
float total,average;
int main()

{
string name;

cout << "hole #1 " << endl;

cin >> h1;

cout << "hole #2 " << endl;

cin >> h2;

cout << "hole #3 " << endl;

cin >> h3;

cout << "hole #4 " << endl;

cin >> h4;

cout << "hole #5 " << endl;

cin >> h5;

cout << "hole #6 " << endl;

cin >> h6;

cout << "hole #7 " << endl;

cin >> h7;

cout << "hole #8 " << endl;

cin >> h8;

cout << "hole #9 " << endl;

cin >> h9;

cout << "hole #10 " << endl;

cin >> h10;

cout << "hole #11 " << endl;

cin >> h11;

cout << "hole #12 " << endl;

cin >> h12;

cout << "hole #13 " << endl;

cin >> h13;

cout << "hole #14 " << endl;

cin >> h14;

cout << "hole #15 " << endl;

cin >> h15;

cout << "hole #16 " << endl;

cin >> h16;

cout << "hole #17 " << endl;

cin >> h17;

cout << "hole #18 " << endl;

cin >> h18;



total= h1+h2+h3+h4+h5+h6+h7+h8+h9+h10+h11+
h12+h13+h14+h15+h16+h17+h18;

average=total/18;




cin.get();
cin.get();
return 0;
}
Last edited on
Could you elaborate on the problem a little bit more? I don't understand what you mean.

In any case, you would be well served to eliminate your global variables and make use of arrays and for loops for this assignment.
Topic archived. No new replies allowed.