Writing Code but am having problems

This is a discussion on Writing Code but am having problems within the C Programming forums, part of the General Programming Boards category; umm what i wrote was for stringLen is that not correct either? i can not add or modify main at ...

  1. #16
    Registered User
    Join Date
    Jun 2009
    Posts
    11
    umm what i wrote was for stringLen

    is that not correct either?

    i can not add or modify main at all.

  2. #17
    Registered User
    Join Date
    Jun 2009
    Posts
    11
    so is the what you mean itCbitC
    //code
    stringLen(char *pWord)
    {
    int count

    count=0;

    while
    ++pWord;
    ++count;
    return;

  3. #18
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> so is the what you mean itCbitC

    Why don't you compile it and see for yourself?
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #19
    Registered User
    Join Date
    Jun 2009
    Posts
    11
    i compiled it but it gave me token error.

  5. #20
    Registered User
    Join Date
    Jun 2009
    Posts
    11
    when it says token error whats it mean?

  6. #21
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> when it says token error whats it mean?

    It means the compiler encountered an 'unexpected' character sequence. The easiest way to go about this is to strip everything down until you have something that compiles. First write a function that does nothing. Return a default value. If that compiles, try to set up an empty loop. If that compiles, add a bit of code little by little, compiling and printing values after every change. That's the basic idea, anyway. And above all, find good books, or online tutorials, and read them over and over until you actually understand the syntax, before actually attempting to write code.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with code
    By hollyjaye in forum C Programming
    Replies: 11
    Last Post: 03-29-2007, 05:42 AM
  2. Temperature Conversion code problems
    By eroth88 in forum C Programming
    Replies: 6
    Last Post: 10-22-2006, 01:24 AM
  3. Code writing issues Part 2...
    By jaybo684 in forum C++ Programming
    Replies: 10
    Last Post: 08-01-2005, 08:28 AM
  4. structs, array, code has problems, Im lost
    By rake in forum C++ Programming
    Replies: 4
    Last Post: 03-13-2002, 01:02 AM
  5. problems with output from code
    By simhap in forum C++ Programming
    Replies: 0
    Last Post: 10-08-2001, 12:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21