Salem_c's Profile User Rating: ****-

Reputation: 1773 Grandmaster
Group:
Mentors
Active Posts:
3,435 (2.06 per day)
Joined:
30-May 10
Profile Views:
38,542
Last Active:
User is offline Today, 02:34 AM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   Salem_c has not set their status

Posts I've Made

  1. In Topic: how to avoid rewriting the same code for other levels?

    Posted 25 Dec 2014

    First, you need to learn how to write functions.
    100's of lines of code in main() are doing you no favours.


    Eg.
    const int MAPSIZE = 20;
    
    void readmap( int level, char map[MAPSIZE ][MAPSIZE ] ) {
      char filename[50];
      sprintf(filename,"maplevel_%02d.txt", level );
      // read from file into map
      // you now have 99 levels to play with, each in
      // a file maplevel_01.txt to maplevel_99.txt
    }
    
    int main ( ) {
      char map[MAPSIZE ][MAPSIZE ];
      int level = 1;
      bool alive = true;
      while ( alive ) {
        readmap(level,map);
        alive = play(map);
        if ( alive ) level++;
      }
      return 0;
    }
    
    
  2. In Topic: read serial in c

    Posted 24 Dec 2014

    I guess in the 6 minutes it took you to
    - get the notification
    - read the link - however briefly
    - bounce back with another "feed me" post

    you missed section 1.4 of the howto.

    Merry xmas.
  3. In Topic: Taylor expansion

    Posted 24 Dec 2014

    Another day, and more "found" code -> https://www.google.c...m:oldsum-sum%22

    It doesn't even compile.
    gcc -std=c99 main.c                                   
    main.c:4:5: warning: conflicting types for built-in function 'sin' 
    [enabled by default]                                               
     int sin (double x)                                                
         ^                                                             
    main.c: In function 'sin':                                         
    main.c:8:8: error: invalid operands to binary % (have 'double' and 
    'double')                                                          
      fi=y=x% (2*pi);                                                  
            ^                                                          
    main.c:9:9: error: 'oldsum' undeclared (first use in this function)
      sum=y; oldsum=0;                                                 
             ^                                                         
    main.c:9:9: note: each undeclared identifier is reported only once 
    for each function it appears in                                    
    
    


    Listen kid, if you want to learn how to program, you need to do more than just google for source code, then dump it on a forum for others to explain to you.

    You might think you understand it at the end of the thread, but you won't.
  4. In Topic: read serial in c

    Posted 24 Dec 2014

    http://www.tldp.org/...rial-HOWTO.html
  5. In Topic: Node insertion into Boost Libraries' PTree not working in MSVC C++

    Posted 24 Dec 2014

    Cross-posted here http://stackoverflow...rking-in-msvc-c
    And here http://www.codeproje...ibraries-PTNode

    Read about forum netiquette http://www.catb.org/...-questions.html

My Information

Member Title:
void main'ers are DOOMED
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Programming Languages:
C, C++, Perl, awk, various assemblers

Contact Information

E-mail:
Private

Comments

Page 1 of 1
  1. Photo

    fromTheSprawl Icon

    07 Sep 2012 - 02:38
    Please read my thread. I kid! Just want to say your forum avatar is awesome. ^^
  2. Photo

    Salem_c Icon

    26 Dec 2010 - 01:36
    Do not PM me for 1:1 support, or to try to get me to read your threads.
Page 1 of 1