Thread: Noob Question regarding Pointer-to-Object type

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    1

    Noob Question regarding Pointer-to-Object type

    OK, total noob in C++ here. A little help would really be appreciated. I'm getting a couple errors, and am not sure how to proceed:

    1>------ Build started: Project: 8, Configuration: Debug Win32 ------
    1>Build started 11/20/2010 8:26:09 PM.
    1>InitializeBuildStatus:
    1> Touching "Debug\8.unsuccessfulbuild".
    1>ClCompile:
    1> 8C.cpp
    1>d:\my docs\school\fund prog\chapter 8\8\8\8c.cpp(33): error C2106: '=' : left operand must be l-value
    1>d:\my docs\school\fund prog\chapter 8\8\8\8c.cpp(50): error C2109: subscript requires array or pointer type
    1>d:\my docs\school\fund prog\chapter 8\8\8\8c.cpp(55): error C2065: 'Lowin' : undeclared identifier
    1>d:\my docs\school\fund prog\chapter 8\8\8\8c.cpp(57): error C2065: 'Lowin' : undeclared identifier
    1>d:\my docs\school\fund prog\chapter 8\8\8\8c.cpp(57): fatal error C1903: unable to recover from previous error(s); stopping compilation
    1>
    1>Build FAILED.
    1>
    1>Time Elapsed 00:00:00.90
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Code follows:

    Code:
    #include <iomanip>
    #include <iostream>
    using namespace std;
    
    int main()
    {
     
    	const int Numgrade = 6;
    	int Score [Numgrade];
    	int Count;
    	int Grade;
    	int Scorein;
    	int av;
    	int sum;
    	int Lowin;
    
    	// Function
    	void Lowscore (int Grade, double Lowin[Numgrade]);
    	{
    	int Scorein[Numgrade];
    	int Lowin[Numgrade];
    
        // Start Function Loop
    	
    
       while (1)
       {
          if (Grade[Lowin]>Grade[Scorein])
          {
             Lowin = Scorein;
          }
          else
          {
          }
          Count =Count+1;
          if (Count>6) break;
       }
    }
    
    // Start Main Loop
       
       cout << "Input Test Scores" << endl;   while (1)
       {
    	  
    	  cout << "Input Test Score" << endl;
          cin >> Score[Numgrade];
          Grade[Count] = Score;
          Count =Count+1;
          if (Count>6) break;
       }
       int Lowin;
      
       Lowscore(Grade,Lowin);
       av =0;
       while (!(Count==Lowin))
       {
          Count =Count+1;
          av =(sum-Lowin)/(Numgrade-1);
       }
       cout << "Your Test Average is "+av << endl;
       return 0;
    }
    Thanks in advance! I know this is pretty basic, but I'm trying to learn!

  2. #2
    Registered User
    Join Date
    Jan 2010
    Posts
    34
    First:
    Grade is an integer and not an integer array.

  3. #3
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Several errors.

    You are using int Grade as an array of ints, but you have not declared it as an array of ints. Same with you double Lowin.

    You have declared variable Lowin twice in the same scope as an int. And, you are using it as a double in the arg list for your Lowscore function. So, you've declared it 3 times.

    Move the Lowscore function outside of main. Note that you have "declared" this function, but never "defined" this function.

    Fix those errors and see how it goes.
    Mainframe assembler programmer by trade. C coder when I can.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. passing argument from incompatible pointer type
    By bhdavis1978 in forum C Programming
    Replies: 5
    Last Post: 03-17-2010, 12:42 PM
  2. c program error
    By cutelucks in forum C Programming
    Replies: 14
    Last Post: 12-21-2007, 11:12 PM
  3. Pointer question
    By rakan in forum C++ Programming
    Replies: 2
    Last Post: 11-19-2006, 02:23 AM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  5. Erros in Utility Header File
    By silk.odyssey in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2003, 06:17 AM