CS-Reloaded Banner
Welcome, Guest. Please Login or Register.
Download Third Map Pack!
Get more packs here

Home Help Search Login Register

CSReloaded Forums  |  General Category  |  Help & Troubleshooting (Moderator: Guardian_Tenshi)  |  Topic: C++ debugging anyone?
Pages: [1] Reply Notify of replies
   Author  Topic: C++ debugging anyone?  (Read 52 times)
Guardian_Tenshi
Global Moderator
*****
Karma: +53/-26

Offline

Gender: Male
Posts: 1114

276733708 276733708 clanguardian2003 Ol+Grimmy
View Profile WWW E-Mail
C++ debugging anyone?
« on: January 22, 2004, 01:42:19 AM »
Reply with quote

ok, so they assigned this nice "easy" assignment to get back into the jist of writing C++ pgms, and now instead of ANSI C, it's all straight C++.  No worries, not that hard to make the switch...but I think I've finished the assignment, but I'm having some problems compiling...it keeps telling me that:

assign1.cc:120: parse error before `)' token
assign1.cc:128: parse error before `)' token

The function in question is this one:
Code:

*****************************************************************************************/
double drawTable(double hitemp,double lotemp,int tempinc,double hispeed,double lospeed,int spdinc)
      {
         double i,j,k;    //loop counters
         cout << endl << "Air temperature";
         cout << setw(8) << "(deg. F)";
         for (i=hitemp,i=lotemp,i+=tempinc)  //line 120
             {
                cout << setw(8) << i;
            }
        //cout << endl << "--------------------------" << endl;
        for (j=lospeed,j=highspeed,j+=spdinc)
            {
               cout << j;
               for (k=hitemp,k=lotemp,k+=tempinc)  //line 128
                   {
                      cout << calcWindChill(k,j);
                   }
                cout << endl;
            }
      }
/****** END FUNC #2********/

It's not due til tuesday, but I'd like to have it figured it out before then.

Tenshi
Logged

Porter
[Wumpa]
Board Admin
*****
Karma: +176/--88

Offline

Gender: Male
Posts: 3910

Wumpa+Porter
View Profile WWW E-Mail
Re:C++ debugging anyone?
« Reply #1 on: January 22, 2004, 08:03:25 AM »
Reply with quote

I think the problem is that you need to use semi-colons in your for() statement, not commas.
Logged

[Wumpa] Porter
  --Silent, professional, lethal... sometimes.
Deuce
CSR Super Ultra Mega Nerd
Global Moderator
*****
Karma: +169/--41

Offline

Gender: Male
Posts: 2914

DarkRusky
View Profile E-Mail
Re:C++ debugging anyone?
« Reply #2 on: January 22, 2004, 08:20:30 AM »
Reply with quote

10 PRINT "HA HA HA"
20 GOTO 10


sorry..thats the best i can do to help
Logged




Fotty
Admin Team
CSR Connoisseur
*****
Karma: +35/-10

Offline

Gender: Male
Posts: 840

ShootMeIntoSpace
View Profile E-Mail
Re:C++ debugging anyone?
« Reply #3 on: January 22, 2004, 08:20:33 AM »
Reply with quote

yup C for statements are semicolon all the way 
Logged

Guardian_Tenshi
Global Moderator
*****
Karma: +53/-26

Offline

Gender: Male
Posts: 1114

276733708 276733708 clanguardian2003 Ol+Grimmy
View Profile WWW E-Mail
Re:C++ debugging anyone?
« Reply #4 on: January 22, 2004, 06:36:47 PM »
Reply with quote

the correction in my for loop exit conditions fixed the compiling problems, i had to make a few other corrections to clean up my output, but not a big deal, for the most part.  By the way porter,to "clear the screen" you can use the \f in a print statement to get a nice fresh screen. 

Code:

std::cout << "\f";  //clears screen

Thanks for everyone who offered help 

Tenshi
Logged

Porter
[Wumpa]
Board Admin
*****
Karma: +176/--88

Offline

Gender: Male
Posts: 3910

Wumpa+Porter
View Profile WWW E-Mail
Re:C++ debugging anyone?
« Reply #5 on: January 22, 2004, 10:25:10 PM »
Reply with quote

See, you learn something every day.
Logged

[Wumpa] Porter
  --Silent, professional, lethal... sometimes.
Guardian_Tenshi
Global Moderator
*****
Karma: +53/-26

Offline

Gender: Male
Posts: 1114

276733708 276733708 clanguardian2003 Ol+Grimmy
View Profile WWW E-Mail
Re:C++ debugging anyone?
« Reply #6 on: January 27, 2004, 01:54:05 PM »
Reply with quote

i should point out though that \f implies "form feed" and it doesn't work on all machines...it works on the schools machines, but Dr.McMahon doesn't recommend using it as an everyday thing...in fact, he basically told me i should take it out of my code...I was impressed that I at least found it though...

Tenshi
Logged

Porter
[Wumpa]
Board Admin
*****
Karma: +176/--88

Offline

Gender: Male
Posts: 3910

Wumpa+Porter
View Profile WWW E-Mail
Re:C++ debugging anyone?
« Reply #7 on: January 27, 2004, 02:12:18 PM »
Reply with quote

Yeah, in today's age it's MUCH more important for your code to be portable that "clean looking".
Logged

[Wumpa] Porter
  --Silent, professional, lethal... sometimes.
Fotty
Admin Team
CSR Connoisseur
*****
Karma: +35/-10

Offline

Gender: Male
Posts: 840

ShootMeIntoSpace
View Profile E-Mail
Re:C++ debugging anyone?
« Reply #8 on: January 27, 2004, 03:54:26 PM »
Reply with quote

thats why all the code i write is dirty 
Logged

Pages: [1] Reply Notify of replies 
CSReloaded Forums  |  General Category  |  Help & Troubleshooting (Moderator: Guardian_Tenshi)  |  Topic: C++ debugging anyone?
Jump to: 

Powered by PHP CSReloaded Forums | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
Powered by MySQL
:[ Site Design by Ryo, scripts and backends by Porter and Ryo, banner by Supafly! Powered by PHP and MySQL ]:
Page created in 0.043 seconds.