Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming

Reply
 
LinkBack Thread Tools
Old 06-15-05   #1 (permalink)
XBox 360 Gamer
 
Chim3ra's Avatar
 
intel nvidia

Join Date: Mar 2005
Location: Rota, Espana
Posts: 4,359

Rep: 429 Chim3ra is a proven memberChim3ra is a proven memberChim3ra is a proven memberChim3ra is a proven memberChim3ra is a proven member
Unique Rep: 277
FAQs Submitted: 7
Trader Rating: 3
Default New code, new problem

#include <stdio.h>
#define cv_factor = 36 * 36; /*conversion:sq in per yard*/

int main(void)

{
int length, width, sum; /*Variable decleration*/

printf("Input length and width of Lawn in yards,\n"); /*Request length and width of lawn in yards*/
sum = (length * width)/cv_factor; /*Multiply Length by width and divide by 12 for yardage*/
scanf("%d%d", &length, &width); /*Accept Length and width assign to memory slots a and b respectively*/
printf("%s%d%s\n","The square yardage of your lawn is", "sum", "bye\n"); /*Display answer*/

}

For some reason i'm getting a c2059 syntax error. it's something to do with the equal sign. i've worked this down as far as i could but still don't understand whats wrong with the equal sign. one thing i'm not to sure about is how i've got the "cv_factor" setup, meaning is it inserted into the code correctly?
__________________
Read and heed, The Forum TS!!!
Trouble finding the FAQ page? Go Here
Help us, help you. Fill out your System Specs.
New to the art of Overclocking? Read these to get you started in the right direction. AMD Intel
XBox Live Gamertag: Wikk3d

System: The Stocker
CPU
Q9300
Motherboard
EVGA 750 SLI FTW
Memory
4GB G.Skill DDR2-800
Graphics Card
EVGA 9800 GTX KO
Hard Drive
Seagate Barracuda ES.2 ST3250310NS
Sound Card
SB X-FI Platinum
Power Supply
FSP Epsilon 600
Case
Antec P180
CPU cooling
Xigmatek HDT-S1283
GPU cooling
Stock
OS
Windows Vista SP1
Monitor
Dell 2405 FPW
Chim3ra is offline Overclocked Account Chim3ra's Gallery   Reply With Quote
Old 06-15-05   #2 (permalink)
Site Old-timer
 
Lostnhell's Avatar
 
amd nvidia

Join Date: Sep 2004
Location: Virginia Beach, VA
Posts: 5,765

Rep: 490 Lostnhell is a proven memberLostnhell is a proven memberLostnhell is a proven memberLostnhell is a proven memberLostnhell is a proven member
Unique Rep: 264
FAQs Submitted: 10
Hardware Reviews: 11
Trader Rating: 3
Default

Why do you have the calculator before the input?
__________________
System: My System
CPU
Athlon 3200+
Sound Card
onboard
OS
Slackware-current
Lostnhell is offline Overclocked Account   Reply With Quote
Old 06-15-05   #3 (permalink)
Programmer
 
MrSmiley's Avatar
 
amd nvidia

Join Date: Oct 2004
Location: Manhattan, Kansas
Posts: 1,060

Rep: 72 MrSmiley is acknowledged by some
Unique Rep: 57
FAQs Submitted: 1
Hardware Reviews: 1
Trader Rating: 0
Default

PHP Code:
 #include    <stdio.h>
  #define cv_factor = 36 * 36; /*conversion:sq in per yard*/
  
  
int main(void)
  
  {
      
int    lengthwidthsum/*Variable decleration*/
  
      
printf("Input length and width of Lawn in yards,\n"); /*Request length and width of lawn in yards*/
      
sum = (length width)/cv_factor/*Multiply Length by width and divide by 12 for yardage*/
      
scanf("%d%d", &length, &width); /*Accept Length and width assign to memory slots a and b respectively*/
      
printf("%s%d%s\n","The square yardage of your lawn is""sum""bye\n"); /*Display answer*/
  
  

First things first, clean that **** up dude. I am short a compiler atm, so one my corrections may be a bit off.
PHP Code:
  #include    <stdio.h>
 // remove pre-processor, make it const#define cv_factor = 36 * 36;
 //conversion:sq in per yard
   
   
int main(void)
   
   {
       
int    lengthwidthsum//Variable decleration
   
const int cvFactor 1296;
       
printf("Input length and width of Lawn in yards,\n"); //Request length and width of lawn in yards
       
scanf("%d%d", &length, &width); //Accept Length and width assign to memory slots a and b respectively
 
sum = (length width)/cvFactor//Multiply Length by width and divide by 12 for yardage
       
printf("%s%d%s\n","The square yardage of your lawn is""sum""bye\n"); //Display answer
   
   

Clean that **** up dude, if you must use preprocessor just define it as 1296 not as 36*36. sum needs to be AFTER scanf, otherwise it is trying to multiply two unref variables.
__________________
System: My System
CPU
Intel 2.8GHz
Motherboard
ESG smth
Power Supply
Antec TruePower 350Watt
OS
FreeBSD
MrSmiley is offline   Reply With Quote
Old 06-15-05   #4 (permalink)
XBox 360 Gamer
 
Chim3ra's Avatar
 
intel nvidia

Join Date: Mar 2005
Location: Rota, Espana
Posts: 4,359

Rep: 429 Chim3ra is a proven memberChim3ra is a proven memberChim3ra is a proven memberChim3ra is a proven memberChim3ra is a proven member
Unique Rep: 277
FAQs Submitted: 7
Trader Rating: 3
Default

Quote:
Originally Posted by MrSmiley
PHP Code:
  #include    <stdio.h>
   #define cv_factor = 36 * 36; /*conversion:sq in per yard*/
   
   
int main(void)
   
   {
       
int    lengthwidthsum/*Variable decleration*/
   
       
printf("Input length and width of Lawn in yards,\n"); /*Request length and width of lawn in yards*/
       
sum = (length width)/cv_factor/*Multiply Length by width and divide by 12 for yardage*/
       
scanf("%d%d", &length, &width); /*Accept Length and width assign to memory slots a and b respectively*/
       
printf("%s%d%s\n","The square yardage of your lawn is""sum""bye\n"); /*Display answer*/
   
   

First things first, clean that **** up dude. I am short a compiler atm, so one my corrections may be a bit off.
PHP Code:
   #include    <stdio.h>
  // remove pre-processor, make it const#define cv_factor = 36 * 36;
  //conversion:sq in per yard
    
    
int main(void)
    
    {
        
int    lengthwidthsum//Variable decleration
    
const int cvFactor 1296;
        
printf("Input length and width of Lawn in yards,\n"); //Request length and width of lawn in yards
        
scanf("%d%d", &length, &width); //Accept Length and width assign to memory slots a and b respectively
  
sum = (length width)/cvFactor//Multiply Length by width and divide by 12 for yardage
        
printf("%s%d%s\n","The square yardage of your lawn is""sum""bye\n"); //Display answer
    
    

Clean that **** up dude, if you must use preprocessor just define it as 1296 not as 36*36. sum needs to be AFTER scanf, otherwise it is trying to multiply two unref variables.
check the attitude, i'm just starting with this stuff so easy. the reason i used 36 * 36 is because that is what my textbook gave me. the reason they gave that instead of 1296 is because most people will equate 36 times 2 to a square yard more so than 1296.
__________________
Read and heed, The Forum TS!!!
Trouble finding the FAQ page? Go Here
Help us, help you. Fill out your System Specs.
New to the art of Overclocking? Read these to get you started in the right direction. AMD Intel
XBox Live Gamertag: Wikk3d

System: The Stocker
CPU
Q9300
Motherboard
EVGA 750 SLI FTW
Memory
4GB G.Skill DDR2-800
Graphics Card
EVGA 9800 GTX KO
Hard Drive
Seagate Barracuda ES.2 ST3250310NS
Sound Card
SB X-FI Platinum
Power Supply
FSP Epsilon 600
Case
Antec P180
CPU cooling
Xigmatek HDT-S1283
GPU cooling
Stock
OS
Windows Vista SP1
Monitor
Dell 2405 FPW
Chim3ra is offline Overclocked Account Chim3ra's Gallery   Reply With Quote
Old 06-15-05   #5 (permalink)
XBox 360 Gamer
 
Chim3ra's Avatar
 
intel nvidia

Join Date: Mar 2005
Location: Rota, Espana
Posts: 4,359

Rep: 429 Chim3ra is a proven memberChim3ra is a proven memberChim3ra is a proven memberChim3ra is a proven memberChim3ra is a proven member
Unique Rep: 277
FAQs Submitted: 7
Trader Rating: 3
Default

i moved the "sum =" line and it still didn't compile right and i'm getting the same error. any other ideas guys?
__________________
Read and heed, The Forum TS!!!
Trouble finding the FAQ page? Go Here
Help us, help you. Fill out your System Specs.
New to the art of Overclocking? Read these to get you started in the right direction. AMD Intel
XBox Live Gamertag: Wikk3d

System: The Stocker
CPU
Q9300
Motherboard
EVGA 750 SLI FTW
Memory
4GB G.Skill DDR2-800
Graphics Card
EVGA 9800 GTX KO
Hard Drive
Seagate Barracuda ES.2 ST3250310NS
Sound Card
SB X-FI Platinum
Power Supply
FSP Epsilon 600
Case
Antec P180
CPU cooling
Xigmatek HDT-S1283
GPU cooling
Stock
OS
Windows Vista SP1
Monitor
Dell 2405 FPW
Chim3ra is offline Overclocked Account Chim3ra's Gallery   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 03:54 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.16507 seconds with 8 queries