• Post Reply Bookmark Topic Watch Topic
  • New Topic

Beginner Array Help  RSS feed

 
Rodshaun Bottoms
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having trouble realizing a problem I'm having with my Arrays.
End result is suppose to display Team Name, and Team Members, from user input any help is appreciated, thanks!
 
Stevens Miller
Bartender
Posts: 1444
30
C++ Java Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch, Rodshaun. I've added codetags to your post, which makes the code a lot easier to read. Have a look and be sure to UseCodeTags whenever you can.
 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

NUM_TEAMS is not declared so code does not complile

This for loop opens the scope using the variable x as a single statement (but you have a block defined in the next statement so it goes on more than 1 line)

this for loop opens the scope using the variable y for a block defined by {}

Here you open another scope using the variable x without closing the previous scope, so your x variable is being double tasked and expectations may not be realized for your original scope using x

closes your second scope using x

closes your scope using y and allows your first scope using x to close


So basically your undefinded NUM_TEAMS and the double use of the variable x is causing your problems in your overlapping scopes.
 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You basically have this, and are achieving very similar results:
 
Rodshaun Bottoms
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it to work much appreciated!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!