GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 15-Dec-2003, 17:42
mike3340 mike3340 is offline
New Member
 
Join Date: Oct 2003
Posts: 6
mike3340 is an unknown quantity at this point

Implicit Declaration error


i'm getting an Implicit declaration of function error when i'm running this code. i'm opening a text file containing 365 temperatures and writing them to a 2D array called temps[][]. then i put all the temperatures for january into a 1D array called jan[]. i want to sort all these temperatures in jan[] by using bubble sort, but i'm getting this error when i call the function bubbleUp at the orange line....anybody know why??
CPP / C++ / C Code:
#include <fstream.h>
#include <iostream.h>
#include <iomanip.h>
#include <limits.h>
int main()
{
void bubbleSort (int list [ ], int last);
void bubbleUp (int list[ ], int first, int last);

  int yearTemps[365];
  int jan[31];
  int temps[33][14];
  int last = 32;
  ifstream ins;
  ofstream outs;
  outs.open("output.txt");
  ins.open("FAI1965.txt");

  for(int j = 1; j < 32; j++)
    {
  for(int i = 0; i < 13; i++)
    {
      if(temps[j][i] == 999)
        outs << "***" << "  ";
      else
outs << temps[j][i] << "   ";
    }
  outs << endl;
    }

  for(int j = 1; j < 32; j++)
    {
    for (int i = 0; i < 13; i++)
    {
      yearTemps[i] = temps[j][i];
    }
    }

for (int i = 1; i< 32; i++)
{
   jan[i] = temps[i][1];
}

        bubbleSort (jan, 31);

return 0;
}

void bubbleSort (int list[], int last)
{
        int current;

         for(current = 0; current < last; current++)
            [color=DarkOrange][b]bubbleUp (list, current, last);[/b][/color]
        return;
}       // bubbleSort

void bubbleUp (int list[ ],
               int current,
               int last)
{
        int walker;
        int temp;

        for (walker = last; walker > current; walker--)

           if (list[ walker ]  < list[ walker - 1 ])
             {
               temp             = list[walker];
               list[walker]     = list[walker - 1];
               list[walker - 1] = temp;
              } // if
        return;
}       // bubbleUp
  #2  
Old 16-Dec-2003, 08:12
Garth Farley Garth Farley is offline
Invalid Email Address
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
I'm unsure if this will solve your problem, but I've was taught you don't define your functions inside the main() , you define them above main.

Worth a go
GF
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 3) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in ukrspp21 MySQL / PHP Forum 31 04-Jul-2006 21:41
Including Maps and strings?? maddie C++ Forum 17 05-Jul-2004 06:25
error during program rjd72285 C++ Forum 0 11-Nov-2003 18:49
[script] E-mail webmaster error page BobbyDouglas PHP Code Library 0 19-Aug-2003 20:10
CD burner, focus or tracking error ShingoDrrazz Computer Hardware Forum 1 09-Aug-2003 16:26

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 20:40.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.