Go to Post Ask two different FIRSTers for an opinion, get three different answers! - pfreivald [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #46   Spotlight this post!  
Unread 14-09-2008, 21:48
David Doerr's Avatar
David Doerr David Doerr is offline
Registered User
FRC #4478 (Materia Oscura)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Milford, Michigan, USA
Posts: 75
David Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud of
Re: C Programming Homework Help Needed

Hi Pat,

Shouldn't your "for" loop start with its index set to 2 rather than 3? Your array size is 3 -- with an index of 0, 1 or 2.

Dave D
  #47   Spotlight this post!  
Unread 14-09-2008, 21:53
Pat McCarthy Pat McCarthy is offline
FiM Volunteer
FRC #0067 (HOT Team)
Team Role: Alumni
 
Join Date: May 2003
Rookie Year: 2003
Location: Grand Rapids, MI
Posts: 593
Pat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond repute
Send a message via AIM to Pat McCarthy
Re: C Programming Homework Help Needed

I just fixed that, but I'm still having the same problem.
As an example, I'll enter 1111 and the error checking appears to work, but then I'll enter 1211 and it will say there is an error with the second digit. This happens for any digit that has a value of 2.
__________________
2003-2006: FRC Team 67 - Drafter, Driver, Student Leader
2006 Volunteering: Kettering Kickoff Ref, Team Ford FIRST Robotics Invitational Ref
2007 Volunteering: GLR Field Reset/Repair; WMR Robot Inspector and Scorekeeper; MARC Referee
2008 Volunteering: WMR Planning Committee, WMR Scorekeeper, MARC Ref, IRI Scorekeeping, WMRI Scorekeeping & DJ
2009 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2010 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2011 Volunteering: Waterford District, West Michigan District, MARC, & IRI DJ
2012 Volunteering: Waterford District, West Michigan District DJ
  #48   Spotlight this post!  
Unread 14-09-2008, 21:56
David Doerr's Avatar
David Doerr David Doerr is offline
Registered User
FRC #4478 (Materia Oscura)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Milford, Michigan, USA
Posts: 75
David Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud of
Re: C Programming Homework Help Needed

Sorry, no, your index is OK, but your array declaration should read

int num[4];

not

int num[3];
  #49   Spotlight this post!  
Unread 14-09-2008, 21:59
Pat McCarthy Pat McCarthy is offline
FiM Volunteer
FRC #0067 (HOT Team)
Team Role: Alumni
 
Join Date: May 2003
Rookie Year: 2003
Location: Grand Rapids, MI
Posts: 593
Pat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond repute
Send a message via AIM to Pat McCarthy
Re: C Programming Homework Help Needed

Thanks Dave! That seems to have taken care of it!
It's been a year since I've written code, so I'm a bit rusty.
__________________
2003-2006: FRC Team 67 - Drafter, Driver, Student Leader
2006 Volunteering: Kettering Kickoff Ref, Team Ford FIRST Robotics Invitational Ref
2007 Volunteering: GLR Field Reset/Repair; WMR Robot Inspector and Scorekeeper; MARC Referee
2008 Volunteering: WMR Planning Committee, WMR Scorekeeper, MARC Ref, IRI Scorekeeping, WMRI Scorekeeping & DJ
2009 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2010 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2011 Volunteering: Waterford District, West Michigan District, MARC, & IRI DJ
2012 Volunteering: Waterford District, West Michigan District DJ
  #50   Spotlight this post!  
Unread 14-09-2008, 22:04
David Doerr's Avatar
David Doerr David Doerr is offline
Registered User
FRC #4478 (Materia Oscura)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Milford, Michigan, USA
Posts: 75
David Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud ofDavid Doerr has much to be proud of
Re: C Programming Homework Help Needed

That C structured programming class seems to be dragging out for quite some time. It might be about time to start in on C++.

  #51   Spotlight this post!  
Unread 14-09-2008, 22:09
Pat McCarthy Pat McCarthy is offline
FiM Volunteer
FRC #0067 (HOT Team)
Team Role: Alumni
 
Join Date: May 2003
Rookie Year: 2003
Location: Grand Rapids, MI
Posts: 593
Pat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond reputePat McCarthy has a reputation beyond repute
Send a message via AIM to Pat McCarthy
Re: C Programming Homework Help Needed

Quote:
Originally Posted by David Doerr View Post
That C structured programming class seems to be dragging out for quite some time. It might be about time to start in on C++.

Nah, it's been over multiple classes, just all using some C as a component of them.
__________________
2003-2006: FRC Team 67 - Drafter, Driver, Student Leader
2006 Volunteering: Kettering Kickoff Ref, Team Ford FIRST Robotics Invitational Ref
2007 Volunteering: GLR Field Reset/Repair; WMR Robot Inspector and Scorekeeper; MARC Referee
2008 Volunteering: WMR Planning Committee, WMR Scorekeeper, MARC Ref, IRI Scorekeeping, WMRI Scorekeeping & DJ
2009 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2010 Volunteering: Kettering District, MARC, IRI, and WMRI Scorekeeper/Field Power Controller
2011 Volunteering: Waterford District, West Michigan District, MARC, & IRI DJ
2012 Volunteering: Waterford District, West Michigan District DJ
  #52   Spotlight this post!  
Unread 17-09-2008, 13:18
StormRoBoT StormRoBoT is offline
Registered User
no team
 
Join Date: Sep 2008
Location: Malaysia
Posts: 1
StormRoBoT is an unknown quantity at this point
Red face C Programming Homework Help Needed

help on palindrome

i have make a program that can trace palindrome number but i need it to loop over and over again till i keyin -1 then only the program terminate


this is the code that i have used:

Code:
#include<stdio.h>
#include<string.h>

void main()
{
char strsrc[5];
char strtmp[5];

printf("\n Enter a five-digit number ( -1 to end ): "); gets(strsrc);

strcpy(strtmp,strsrc);
strrev(strtmp);

if(strcmp(strsrc,strtmp)==0)
printf("\n %s is a palindrome\n",strsrc);
else
printf("\n %s is not a palindrome\n",strsrc);
}
any one can help?
  #53   Spotlight this post!  
Unread 17-09-2008, 15:56
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: C Programming Homework Help Needed

Quote:
Originally Posted by StormRoBoT View Post
i have make a program that can trace palindrome number but i need it to loop over and over again till i keyin -1 then only the program terminate

any one can help?
You want it to loop? Hint: use a while statement that never ends, putting all the things inside it that you want to keep executing over and over.

You want it to end? Hint: use an exit statement, but only execute it when the program is supposed to terminate.
  #54   Spotlight this post!  
Unread 27-09-2008, 22:15
ShotgunNinja's Avatar
ShotgunNinja ShotgunNinja is offline
Programming Mentor, FRC 4247
AKA: Nicholas Iannone
FRC #4247 (CougarBOTS)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Milwaukee, WI
Posts: 160
ShotgunNinja is a jewel in the roughShotgunNinja is a jewel in the roughShotgunNinja is a jewel in the roughShotgunNinja is a jewel in the rough
Re: C Programming Homework Help Needed

What exactly do you mean by "loop"? Do you want it to repeatedly ask for a number, then check it for palindrome-ness (sorry, vocabulary suffered a non-Build season hit ) , or do you want to loop through calculations (a bit daft, but I don't know what the professor/employer expects...), or what?
__________________
Team #2970 Alum
Team #1652 Alum
2006: School Mascot for Team 1652
2007-2008: Programmer for Team 1652 (Robot Mafia)
2009: Programmer on Team 1652 (Robot Mafia), Programmer on Team 2970 (eSchool eBots)
2010-2016: Volunteer, Wisconsin Regional
2017: Programming Mentor, FRC 4247 (CougarBOTS, Obama SCTE, Milwaukee, WI)
Closed Thread


Thread Tools
Display Modes 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
programming help needed krunal Programming 3 29-01-2007 00:18
Help on a Homework Assignment. Pavan Dave General Forum 1 13-09-2006 14:20
HELP-URGENT PROGRAMMING HELP NEEDED Rohith Surampudi Lego Mindstorm Discussion 1 24-03-2006 23:05
URgent Programming Help needed rcubes85 Programming 4 15-02-2005 23:21


All times are GMT -5. The time now is 18:09.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi