I have an assignment to read from a file and to print only the names that have no spaces in them. This is my text file:
Arkansas
California
Colorado
Connecticut
Delaware
District Of Columbia
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming
American Samoa
District of Columbia
Guam
Northern Mariana Islands
Puerto Rico
United States Virgin Islands
How do I get specific names to print? Thank you for your time.
So you are trying to tell me that after two fairly detailed solutions in this area, one of them from JLBorges whose methods are second to none you still can't do the rest yourself. In that case I need to ask you what have you done on your own so far? Any code? Psuedo-code? Anything from on-line searches?
The difference between "with" and "without" could be just a single change in a
the code, for example change == to != or vice-versa.
At any rate, you could build on an existing working program rather than starting again from scratch.