Thread: Double problem

  1. #1
    Registered User
    Join Date
    Mar 2013

    Double problem

    I am new to programming, learning online and via books. Would appreciate help with this Double error, which states:

    $g++ /tmp/13642987312818.cpp -o /tmp/13642987312818 -lm 2>&1
    /tmp/13642987312818.cpp: In function 'int main()':
    /tmp/13642987312818.cpp:33: error: expected primary-expression before 'double'
    /tmp/13642987312818.cpp:33: error: expected `;' before 'double'

    #include <stdio.h>
    #include <math.h>
    #define C 3
    int main() 
      int v, w;
      float f;
      int i, e;
      double x;
          char n[4];
          printf ("Which species?\n");
          scanf(" %s",n);
          printf(" %s\n",n);
          printf ("What Vm?\n");
          scanf (" %d",&v);
          printf(" %d\n", v);
      printf("Conc in?\n");
      scanf(" %d",&i);
      printf(" %d\n", i);
      printf("Conc out?\n");
      scanf(" %d",&e);
      printf(" %d\n", e);
      x=double log(w);
      f = v - (C*x);
      return 0;

    Thanks !

  2. #2
    Registered User
    Join Date
    Mar 2013
    I will answer my own question :
    Remove previous Double declaration, and replace ln function with:
    double x=log(w);

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    Doing that would leave it conflicting with the definition of x on line 12.
    You probably mean to just remove "double" from line 32 altogether.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Double While Loop Problem
    By Bryan Lassiter in forum C Programming
    Replies: 2
    Last Post: 02-15-2013, 08:51 AM
  2. Problem with abs(double)
    By Elnaz in forum C++ Programming
    Replies: 3
    Last Post: 01-29-2011, 06:57 PM
  3. Double problem
    By cs05pp2 in forum C Programming
    Replies: 11
    Last Post: 10-16-2009, 02:03 PM
  4. double pointer problem
    By a0161 in forum C Programming
    Replies: 4
    Last Post: 05-10-2009, 07:52 AM
  5. double value switch problem
    By axon in forum C++ Programming
    Replies: 4
    Last Post: 02-14-2003, 04:03 PM

Tags for this Thread

Website Security Test