Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-19-2005, 07:09 PM   #1 (permalink)
bradleyc
Registered User
 
Join Date: Aug 2005
Posts: 17
bradleyc is on a distinguished road
Can anyone see...

why if the swimmers[x].name and temp match, why it would just go to ...
cout << " " << endl;
cout << " Press any key to return to menu ....";
input = getch();
if (input)
{
swim::displayMenu();
}

Code:
void Event::updateSwim()
{
char temp[50];
clrscr();
cout  <<  ""  << endl;
cout  <<  " Input Swimmers Name:  ";
cin.getline(temp,50);
cin.ignore();
int found = 0;
for (int  x = 0; x  < numSwimmers && found!=1; x++)
{
      if(strcmp(swimmers[x].name,temp) == 0)
       {
              found = 1;
              cout << "     " << endl;
              cout << " Gender?(m/f): ";
              cin.getline(swimmers[x].sex, SIZE);
              cout << "     " << endl;
              cout << " Event?: ";
              cin.getline(swimmers[x].event, SIZE);
              cout << "     " << endl;
              cout << " Performance?: ";
              cin.getline(swimmers[x].perfrm, SIZE);
              cout << "     " << endl;
              cout << " Name?: ";
              cin.getline(swimmers[x].name, SIZE);
              cout << "     " << endl;
              cout << " Birthday?: ";
              cin.getline(swimmers[x].birthDate, SIZE);
              cout << "     " << endl;
              cout << " Competition Date?: ";
              cin.getline(swimmers[x].compDate, SIZE);
              cout << "     " << endl;
              cout << " Venue: ";
              cin.getline(swimmers[x].venue, SIZE);
              cout << "     " << endl;
              cout << " Position Finished?(1-9): ";
              cin.ignore();
              cin >> swimmers[x].posF;
        }
}
}
Code:
void swim::updateSwim()
{
	clrscr();
   cout << " " << endl;
   cout << " 2. Update Existing Swimmer Menu" << endl;
   cout << " --------------------------------" << endl;
   cout << " " << endl;
   cout << " Would you like to update an existing swimmer(y/n)?: ";
   cin >> inputv;
   if (inputv == 'y' || inputv == 'Y')
   	{
     	 	if (currentE == 1)
      	   	{
      	free100.updateSwim();
      	cout << " " << endl;
      	cout << " Press any key to return to menu ....";
			input = getch();
			if (input)
			{
         swim::displayMenu();
			}
      			}

			else if (currentE == 2)
      	   	{
      	back200.updateSwim();
      	cout << " " << endl;
      	cout << " Press any key to return to menu ....";
			input = getch();
			if (input)
			{
         swim::displayMenu();
			}
     			 }

         else if (currentE == 3)
			   	{
      	medley400.updateSwim();
      	cout << " " << endl;
     		cout << " Press any key to return to menu ....";
			input = getch();
			if (input)
			{
         swim::displayMenu();
			}
      }

			else if (currentE == 4)
            	{
      	back800.updateSwim();
      	cout << " " << endl;
      	cout << " Press any key to return to menu ....";
			input = getch();
			if (input)
			{
         swim::displayMenu();
			}
      }
      }
      else if (inputv == 'n' || inputv == 'N')
      swim::displayMenu();

}
bradleyc is offline   Reply With Quote
Old 10-20-2005, 01:35 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,720
redhead is on a distinguished road
Quote:
Error line 4: clscr() undeclared first use of this identifyer
Error line 10: numSwimmers undeclared first use
....
It just goes on and on, how many swimmers do you have? Are you sure the name you input are exactly represented in your swimmers list ?
The code shown here is of no use what so ever. the proclaimed piece where you error out isn't even represented in the two segments, there isn't any part of it, which would be the smallest compilable part that shows your error....

What is the value of your currentE? What is the value of your inputv ? sometimes the easiest way to figure out why strange things happen, is to fill your code with debug output displaying every variable that might have some influence with the expected behaviour.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 09:28 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting