Help it won't compile!!!!!

This is a discussion on Help it won't compile!!!!! within the C Programming forums, part of the General Programming Boards category; What is good programming practice is not what works for you. Good programming practice is not subjective. It is several ...

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,901
    What is good programming practice is not what works for you. Good programming practice is not subjective. It is several tried-and-true methods for programming, typically figured out by programming experts with far more expertise and knowledge than you.
    Your reply shows how little you truly know and on such a high horse you sit on. No one is forcing you to use good programming practices, but do you not dare call them unproven rules or your own methods good programming practice, because they are not.
    And lastly, you arrogance is truly astounding. I have witnessed it in your previous thread. You do not have the experience nor the knowledge to call yourself an expert, so your practices fall on deaf ears.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by NeonBlack View Post
    Well good luck. I also have to give you credit for this:
    Code:
    		switch(xx){
    			case 'A': c1=12; break;
    			case 'K': c1=11; break;
    			case 'Q': c1=10; break;
    			case 'J': c1=9; break;
    			case 'T': c1=8; break;
    			case '9': c1=7; break;
    			case '8': c1=6; break;
    			case '7': c1=5; break;
    			case '6': c1=4; break;
    			case '5': c1=3; break;
    			case '4': c1=2; break;
    			case '3': c1=1; break;
    			case '2': c1=0; break;
    			default: printf("\n Invalid card 1");
    		}
    		switch(yy){
    			case 'A': c2=12; break;
    			case 'K': c2=11; break;
    			case 'Q': c2=10; break;
    			case 'J': c2=9; break;
    			case 'T': c2=8; break;
    			case '9': c2=7; break;
    			case '8': c2=6; break;
    			case '7': c2=5; break;
    			case '6': c2=4; break;
    			case '5': c2=3; break;
    			case '4': c2=2; break;
    			case '3': c2=1; break;
    			case '2': c2=0; break;
    			default: printf("\n Invalid card 2");
    What's the point in writing functions and reusing the same code when you can just copy-paste code with marginal differences for every global variable?
    I suppose I could have written a function, I didn't really think about it as it was quicker to
    copy and paste and change a few variables. It never crossed my mind, I guess if I had to do it more than twice I might have, I was more concerned about other matters.

    I suppose I could change it but it would make the program slower in a key operation which could be done over a million times, as it happens it runs in a flash anyway.

  3. #18
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,752
    Aw, forget it Elysia, they're just a waste of space and time, and will be nothing more than a glorified "hello world" programmer. Sure, they can bash out a few hundred lines and arrive at a "works for me" answer. But 10K+ line which work for everyone else - forget it.

    Everything that could have been said has been said many times already, so I for one am not going to bother repeating it anymore. They're quite happy paddling in the kiddie pool, so let them stay there.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,901
    Quote Originally Posted by Salem View Post
    Aw, forget it Elysia, they're just a waste of space and time, and will be nothing more than a glorified "hello world" programmer. Sure, they can bash out a few hundred lines and arrive at a "works for me" answer. But 10K+ line which work for everyone else - forget it.
    Yeah, I said my piece. Anything further will just be a waste of key strokes.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by Elysia View Post
    What is good programming practice is not what works for you. Good programming practice is not subjective. It is several tried-and-true methods for programming, typically figured out by programming experts with far more expertise and knowledge than you.
    Your reply shows how little you truly know and on such a high horse you sit on. No one is forcing you to use good programming practices, but do you not dare call them unproven rules or your own methods good programming practice, because they are not.
    And lastly, you arrogance is truly astounding. I have witnessed it in your previous thread. You do not have the experience nor the knowledge to call yourself an expert, so your practices fall on deaf ears.

    No good programming style is literally what works for me.
    And it does, it's my program and it works.

    And who says these people are 'experts'?
    Not me, each other, but then that' surprise, you can't join the back-slappers club unless you agree to their terms and conditions.

    I have the right to call anything unproven until it is proven, I am not being 'daring' by saying that I am merely stating a fact.

    An expert is only as good as the program he produces, not the one he professes he wil produce.

  6. #21
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,901
    Quote Originally Posted by esbo View Post
    An expert is only as good as the program he produces, not the one he professes he wil produce.
    Oh! Good one!
    That means you are the worst possible programmer then, seeing as your code - and in the end, your program - is the worst possible code I have seen!
    I do so agree with that one!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #22
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by Elysia View Post
    Oh! Good one!
    That means you are the worst possible programmer then, seeing as your code - and in the end, your program - is the worst possible code I have seen!
    I do so agree with that one!
    It's not the code which counts it's the output!!
    And here it is!!

    Now I can *prove* that works, I can prove it to by sending you the 100,000 lines of test data. However you cannot prove my how I write my programs is wrong, untill you can do that, well basically you have not *proved* anything have you?


    The last figure is the total number of hands dealt in that type of game.

    Code:
     Done
    
    F 22 105   205.1 21532 
    F 23 116   185.6 21532 
    F 24 124   173.6 21532 
    F 25 129   166.9 21532 
    F 26 123   175.1 21532 
    F 27 143   150.6 21532 
    F 28 132   163.1 21532 
    F 29 130   165.6 21532 
    F 2T 123   175.1 21532 
    F 2J 142   151.6 21532 
    F 2Q 135   159.5 21532 
    F 2K 139   154.9 21532 
    F 2A 119   180.9 21532 
    F 32 131   164.4 21532 
    F 33 93    231.5 21532 
    F 34 140   153.8 21532 
    F 35 129   166.9 21532 
    F 36 118   182.5 21532 
    F 37 136   158.3 21532 
    F 38 135   159.5 21532 
    F 39 145   148.5 21532 
    F 3T 118   182.5 21532 
    F 3J 145   148.5 21532 
    F 3Q 129   166.9 21532 
    F 3K 139   154.9 21532 
    F 3A 135   159.5 21532 
    F 42 134   160.7 21532 
    F 43 134   160.7 21532 
    F 44 90    239.2 21532 
    F 45 145   148.5 21532 
    F 46 138   156.0 21532 
    F 47 146   147.5 21532 
    F 48 130   165.6 21532 
    F 49 123   175.1 21532 
    F 4T 133   161.9 21532 
    F 4J 130   165.6 21532 
    F 4Q 136   158.3 21532 
    F 4K 137   157.2 21532 
    F 4A 120   179.4 21532 
    F 52 144   149.5 21532 
    F 53 134   160.7 21532 
    F 54 120   179.4 21532 
    F 55 76    283.3 21532 
    F 56 138   156.0 21532 
    F 57 149   144.5 21532 
    F 58 149   144.5 21532 
    F 59 139   154.9 21532 
    F 5T 129   166.9 21532 
    F 5J 125   172.3 21532 
    F 5Q 147   146.5 21532 
    F 5K 146   147.5 21532 
    F 5A 123   175.1 21532 
    F 62 121   178.0 21532 
    F 63 136   158.3 21532 
    F 64 131   164.4 21532 
    F 65 127   169.5 21532 
    F 66 96    224.3 21532 
    F 67 125   172.3 21532 
    F 68 131   164.4 21532 
    F 69 111   194.0 21532 
    F 6T 125   172.3 21532 
    F 6J 136   158.3 21532 
    F 6Q 129   166.9 21532 
    F 6K 137   157.2 21532 
    F 6A 133   161.9 21532 
    F 72 137   157.2 21532 
    F 73 120   179.4 21532 
    F 74 108   199.4 21532 
    F 75 129   166.9 21532 
    F 76 130   165.6 21532 
    F 77 84    256.3 21532 
    F 78 117   184.0 21532 
    F 79 129   166.9 21532 
    F 7T 122   176.5 21532 
    F 7J 150   143.5 21532 
    F 7Q 126   170.9 21532 
    F 7K 132   163.1 21532 
    F 7A 131   164.4 21532 
    F 82 139   154.9 21532 
    F 83 117   184.0 21532 
    F 84 134   160.7 21532 
    F 85 147   146.5 21532 
    F 86 141   152.7 21532 
    F 87 119   180.9 21532 
    F 88 90    239.2 21532 
    F 89 135   159.5 21532 
    F 8T 122   176.5 21532 
    F 8J 128   168.2 21532 
    F 8Q 143   150.6 21532 
    F 8K 119   180.9 21532 
    F 8A 133   161.9 21532 
    F 92 145   148.5 21532 
    F 93 124   173.6 21532 
    F 94 144   149.5 21532 
    F 95 121   178.0 21532 
    F 96 130   165.6 21532 
    F 97 136   158.3 21532 
    F 98 120   179.4 21532 
    F 99 93    231.5 21532 
    F 9T 125   172.3 21532 
    F 9J 132   163.1 21532 
    F 9Q 114   188.9 21532 
    F 9K 121   178.0 21532 
    F 9A 138   156.0 21532 
    F T2 122   176.5 21532 
    F T3 108   199.4 21532 
    F T4 123   175.1 21532 
    F T5 123   175.1 21532 
    F T6 132   163.1 21532 
    F T7 133   161.9 21532 
    F T8 144   149.5 21532 
    F T9 123   175.1 21532 
    F TT 105   205.1 21532 
    F TJ 138   156.0 21532 
    F TQ 111   194.0 21532 
    F TK 131   164.4 21532 
    F TA 119   180.9 21532 
    F J2 123   175.1 21532 
    F J3 142   151.6 21532 
    F J4 106   203.1 21532 
    F J5 118   182.5 21532 
    F J6 137   157.2 21532 
    F J7 137   157.2 21532 
    F J8 127   169.5 21532 
    F J9 144   149.5 21532 
    F JT 128   168.2 21532 
    F JJ 91    236.6 21532 
    F JQ 133   161.9 21532 
    F JK 119   180.9 21532 
    F JA 137   157.2 21532 
    F Q2 138   156.0 21532 
    F Q3 111   194.0 21532 
    F Q4 113   190.5 21532 
    F Q5 131   164.4 21532 
    F Q6 152   141.7 21532 
    F Q7 138   156.0 21532 
    F Q8 117   184.0 21532 
    F Q9 126   170.9 21532 
    F QT 120   179.4 21532 
    F QJ 136   158.3 21532 
    F QQ 99    217.5 21532 
    F QK 125   172.3 21532 
    F QA 131   164.4 21532 
    F K2 129   166.9 21532 
    F K3 115   187.2 21532 
    F K4 126   170.9 21532 
    F K5 142   151.6 21532 
    F K6 116   185.6 21532 
    F K7 139   154.9 21532 
    F K8 145   148.5 21532 
    F K9 134   160.7 21532 
    F KT 113   190.5 21532 
    F KJ 113   190.5 21532 
    F KQ 167   128.9 21532 
    F KK 97    222.0 21532 
    F KA 135   159.5 21532 
    F A2 132   163.1 21532 
    F A3 102   211.1 21532 
    F A4 144   149.5 21532 
    F A5 123   175.1 21532 
    F A6 124   173.6 21532 
    F A7 123   175.1 21532 
    F A8 137   157.2 21532 
    F A9 128   168.2 21532 
    F AT 143   150.6 21532 
    F AJ 121   178.0 21532 
    F AQ 127   169.5 21532 
    F AK 129   166.9 21532 
    F AA 106   203.1 21532 
    
    M 22 114   165.8 18901 
    M 23 119   158.8 18901 
    M 24 107   176.6 18901 
    M 25 90    210.0 18901 
    M 26 126   150.0 18901 
    M 27 120   157.5 18901 
    M 28 101   187.1 18901 
    M 29 102   185.3 18901 
    M 2T 93    203.2 18901 
    M 2J 112   168.8 18901 
    M 2Q 118   160.2 18901 
    M 2K 116   162.9 18901 
    M 2A 134   141.1 18901 
    M 32 129   146.5 18901 
    M 33 80    236.3 18901 
    M 34 108   175.0 18901 
    M 35 107   176.6 18901 
    M 36 119   158.8 18901 
    M 37 126   150.0 18901 
    M 38 97    194.9 18901 
    M 39 100   189.0 18901 
    M 3T 101   187.1 18901 
    M 3J 106   178.3 18901 
    M 3Q 113   167.3 18901 
    M 3K 106   178.3 18901 
    M 3A 105   180.0 18901 
    M 42 102   185.3 18901 
    M 43 101   187.1 18901 
    M 44 86    219.8 18901 
    M 45 122   154.9 18901 
    M 46 113   167.3 18901 
    M 47 124   152.4 18901 
    M 48 113   167.3 18901 
    M 49 109   173.4 18901 
    M 4T 103   183.5 18901 
    M 4J 116   162.9 18901 
    M 4Q 116   162.9 18901 
    M 4K 107   176.6 18901 
    M 4A 150   126.0 18901 
    M 52 121   156.2 18901 
    M 53 121   156.2 18901 
    M 54 100   189.0 18901 
    M 55 80    236.3 18901 
    M 56 115   164.4 18901 
    M 57 120   157.5 18901 
    M 58 95    199.0 18901 
    M 59 108   175.0 18901 
    M 5T 115   164.4 18901 
    M 5J 115   164.4 18901 
    M 5Q 115   164.4 18901 
    M 5K 117   161.5 18901 
    M 5A 114   165.8 18901 
    M 62 110   171.8 18901 
    M 63 123   153.7 18901 
    M 64 122   154.9 18901 
    M 65 117   161.5 18901 
    M 66 85    222.4 18901 
    M 67 121   156.2 18901 
    M 68 108   175.0 18901 
    M 69 116   162.9 18901 
    M 6T 99    190.9 18901 
    M 6J 114   165.8 18901 
    M 6Q 104   181.7 18901 
    M 6K 107   176.6 18901 
    M 6A 130   145.4 18901 
    M 72 115   164.4 18901 
    M 73 128   147.7 18901 
    M 74 119   158.8 18901 
    M 75 106   178.3 18901 
    M 76 113   167.3 18901 
    M 77 81    233.3 18901 
    M 78 125   151.2 18901 
    M 79 107   176.6 18901 
    M 7T 108   175.0 18901 
    M 7J 142   133.1 18901 
    M 7Q 113   167.3 18901 
    M 7K 117   161.5 18901 
    M 7A 106   178.3 18901 
    M 82 133   142.1 18901 
    M 83 109   173.4 18901 
    M 84 116   162.9 18901 
    M 85 110   171.8 18901 
    M 86 110   171.8 18901 
    M 87 114   165.8 18901 
    M 88 89    212.4 18901 
    M 89 113   167.3 18901 
    M 8T 111   170.3 18901 
    M 8J 115   164.4 18901 
    M 8Q 113   167.3 18901 
    M 8K 129   146.5 18901 
    M 8A 86    219.8 18901 
    M 92 102   185.3 18901 
    M 93 124   152.4 18901 
    M 94 102   185.3 18901 
    M 95 109   173.4 18901 
    M 96 113   167.3 18901 
    M 97 116   162.9 18901 
    M 98 114   165.8 18901 
    M 99 90    210.0 18901 
    M 9T 127   148.8 18901 
    M 9J 116   162.9 18901 
    M 9Q 103   183.5 18901 
    M 9K 121   156.2 18901 
    M 9A 98    192.9 18901 
    M T2 120   157.5 18901 
    M T3 119   158.8 18901 
    M T4 112   168.8 18901 
    M T5 106   178.3 18901 
    M T6 127   148.8 18901 
    M T7 110   171.8 18901 
    M T8 114   165.8 18901 
    M T9 115   164.4 18901 
    M TT 80    236.3 18901 
    M TJ 109   173.4 18901 
    M TQ 109   173.4 18901 
    M TK 117   161.5 18901 
    M TA 115   164.4 18901 
    M J2 118   160.2 18901 
    M J3 116   162.9 18901 
    M J4 120   157.5 18901 
    M J5 140   135.0 18901 
    M J6 112   168.8 18901 
    M J7 121   156.2 18901 
    M J8 112   168.8 18901 
    M J9 118   160.2 18901 
    M JT 87    217.3 18901 
    M JJ 93    203.2 18901 
    M JQ 108   175.0 18901 
    M JK 127   148.8 18901 
    M JA 127   148.8 18901 
    M Q2 112   168.8 18901 
    M Q3 103   183.5 18901 
    M Q4 95    199.0 18901 
    M Q5 120   157.5 18901 
    M Q6 96    196.9 18901 
    M Q7 120   157.5 18901 
    M Q8 108   175.0 18901 
    M Q9 124   152.4 18901 
    M QT 109   173.4 18901 
    M QJ 119   158.8 18901 
    M QQ 81    233.3 18901 
    M QK 118   160.2 18901 
    M QA 126   150.0 18901 
    M K2 118   160.2 18901 
    M K3 105   180.0 18901 
    M K4 107   176.6 18901 
    M K5 114   165.8 18901 
    M K6 105   180.0 18901 
    M K7 109   173.4 18901 
    M K8 119   158.8 18901 
    M K9 122   154.9 18901 
    M KT 114   165.8 18901 
    M KJ 129   146.5 18901 
    M KQ 112   168.8 18901 
    M KK 72    262.5 18901 
    M KA 114   165.8 18901 
    M A2 112   168.8 18901 
    M A3 122   154.9 18901 
    M A4 123   153.7 18901 
    M A5 115   164.4 18901 
    M A6 109   173.4 18901 
    M A7 111   170.3 18901 
    M A8 118   160.2 18901 
    M A9 116   162.9 18901 
    M AT 130   145.4 18901 
    M AJ 112   168.8 18901 
    M AQ 117   161.5 18901 
    M AK 123   153.7 18901 
    M AA 104   181.7 18901 
    
    P 22 212   220.9 46825 
    P 23 314   149.1 46825 
    P 24 267   175.4 46825 
    P 25 262   178.7 46825 
    P 26 308   152.0 46825 
    P 27 262   178.7 46825 
    P 28 297   157.7 46825 
    P 29 285   164.3 46825 
    P 2T 287   163.2 46825 
    P 2J 264   177.4 46825 
    P 2Q 276   169.7 46825 
    P 2K 295   158.7 46825 
    P 2A 292   160.4 46825 
    P 32 253   185.1 46825 
    P 33 206   227.3 46825 
    P 34 294   159.3 46825 
    P 35 259   180.8 46825 
    P 36 260   180.1 46825 
    P 37 273   171.5 46825 
    P 38 267   175.4 46825 
    P 39 286   163.7 46825 
    P 3T 297   157.7 46825 
    P 3J 287   163.2 46825 
    P 3Q 265   176.7 46825 
    P 3K 272   172.2 46825 
    P 3A 275   170.3 46825 
    P 42 273   171.5 46825 
    P 43 292   160.4 46825 
    P 44 236   198.4 46825 
    P 45 273   171.5 46825 
    P 46 271   172.8 46825 
    P 47 289   162.0 46825 
    P 48 267   175.4 46825 
    P 49 277   169.0 46825 
    P 4T 269   174.1 46825 
    P 4J 272   172.2 46825 
    P 4Q 262   178.7 46825 
    P 4K 274   170.9 46825 
    P 4A 269   174.1 46825 
    P 52 261   179.4 46825 
    P 53 254   184.4 46825 
    P 54 272   172.2 46825 
    P 55 204   229.5 46825 
    P 56 313   149.6 46825 
    P 57 295   158.7 46825 
    P 58 284   164.9 46825 
    P 59 256   182.9 46825 
    P 5T 290   161.5 46825 
    P 5J 273   171.5 46825 
    P 5Q 302   155.0 46825 
    P 5K 291   160.9 46825 
    P 5A 294   159.3 46825 
    P 62 270   173.4 46825 
    P 63 303   154.5 46825 
    P 64 291   160.9 46825 
    P 65 282   166.0 46825 
    P 66 225   208.1 46825 
    P 67 300   156.1 46825 
    P 68 274   170.9 46825 
    P 69 284   164.9 46825 
    P 6T 296   158.2 46825 
    P 6J 273   171.5 46825 
    P 6Q 287   163.2 46825 
    P 6K 266   176.0 46825 
    P 6A 268   174.7 46825 
    P 72 275   170.3 46825 
    P 73 323   145.0 46825 
    P 74 309   151.5 46825 
    P 75 300   156.1 46825 
    P 76 280   167.2 46825 
    P 77 231   202.7 46825 
    P 78 238   196.7 46825 
    P 79 273   171.5 46825 
    P 7T 285   164.3 46825 
    P 7J 315   148.7 46825 
    P 7Q 278   168.4 46825 
    P 7K 283   165.5 46825 
    P 7A 286   163.7 46825 
    P 82 290   161.5 46825 
    P 83 261   179.4 46825 
    P 84 274   170.9 46825 
    P 85 269   174.1 46825 
    P 86 268   174.7 46825 
    P 87 273   171.5 46825 
    P 88 194   241.4 46825 
    P 89 280   167.2 46825 
    P 8T 254   184.4 46825 
    P 8J 294   159.3 46825 
    P 8Q 294   159.3 46825 
    P 8K 281   166.6 46825 
    P 8A 288   162.6 46825 
    P 92 280   167.2 46825 
    P 93 300   156.1 46825 
    P 94 275   170.3 46825 
    P 95 300   156.1 46825 
    P 96 297   157.7 46825 
    P 97 304   154.0 46825 
    P 98 295   158.7 46825 
    P 99 201   233.0 46825 
    P 9T 282   166.0 46825 
    P 9J 322   145.4 46825 
    P 9Q 269   174.1 46825 
    P 9K 260   180.1 46825 
    P 9A 285   164.3 46825 
    P T2 267   175.4 46825 
    P T3 284   164.9 46825 
    P T4 308   152.0 46825 
    P T5 310   151.0 46825 
    P T6 287   163.2 46825 
    P T7 296   158.2 46825 
    P T8 315   148.7 46825 
    P T9 272   172.2 46825 
    P TT 230   203.6 46825 
    P TJ 259   180.8 46825 
    P TQ 283   165.5 46825 
    P TK 250   187.3 46825 
    P TA 284   164.9 46825 
    P J2 267   175.4 46825 
    P J3 277   169.0 46825 
    P J4 263   178.0 46825 
    P J5 281   166.6 46825 
    P J6 296   158.2 46825 
    P J7 294   159.3 46825 
    P J8 291   160.9 46825 
    P J9 263   178.0 46825 
    P JT 298   157.1 46825 
    P JJ 206   227.3 46825 
    P JQ 266   176.0 46825 
    P JK 268   174.7 46825 
    P JA 291   160.9 46825 
    P Q2 315   148.7 46825 
    P Q3 295   158.7 46825 
    P Q4 290   161.5 46825 
    P Q5 298   157.1 46825 
    P Q6 259   180.8 46825 
    P Q7 300   156.1 46825 
    P Q8 262   178.7 46825 
    P Q9 287   163.2 46825 
    P QT 295   158.7 46825 
    P QJ 278   168.4 46825 
    P QQ 198   236.5 46825 
    P QK 290   161.5 46825 
    P QA 303   154.5 46825 
    P K2 284   164.9 46825 
    P K3 284   164.9 46825 
    P K4 288   162.6 46825 
    P K5 292   160.4 46825 
    P K6 296   158.2 46825 
    P K7 269   174.1 46825 
    P K8 283   165.5 46825 
    P K9 282   166.0 46825 
    P KT 270   173.4 46825 
    P KJ 280   167.2 46825 
    P KQ 282   166.0 46825 
    P KK 205   228.4 46825 
    P KA 284   164.9 46825 
    P A2 276   169.7 46825 
    P A3 297   157.7 46825 
    P A4 287   163.2 46825 
    P A5 292   160.4 46825 
    P A6 309   151.5 46825 
    P A7 261   179.4 46825 
    P A8 280   167.2 46825 
    P A9 302   155.0 46825 
    P AT 275   170.3 46825 
    P AJ 265   176.7 46825 
    P AQ 276   169.7 46825 
    P AK 291   160.9 46825 
    P AA 226   207.2 46825

  8. #23
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,901
    Quote Originally Posted by esbo View Post
    It's not the code which counts it's the output!!
    And here it is!!

    Now I can *prove* that works, I can prove it to by sending you the 100,000 lines of test data. However you cannot prove my how I write my programs is wrong, untill you can do that, well basically you have not *proved* anything have you?


    The last figure is the total number of hands dealt in that type of game.
    That's greek to me (in other words, it means nothing to me)!
    But is it really the output that counts? Not how much time it takes you to make and modify the program once you want to achieve another goal, and how stable the program is?

    And frankly, I don't want to test your "program" or "code" because...
    - It uses so much poor programming practices.
    - It looks like an evil mess.
    - It's C.
    - And lastly, because it's made by you
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #24
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by Elysia View Post
    That's greek to me (in other words, it means nothing to me)!
    But is it really the output that counts? Not how much time it takes you to make and modify the program once you want to achieve another goal, and how stable the program is?

    And frankly, I don't want to test your "program" or "code" because...
    - It uses so much poor programming practices.
    - It looks like an evil mess.
    - It's C.
    - And lastly, because it's made by you
    I am the one who stated the requirements and that was that it runs, works and is produced as quickly as possible. It' meets all three.

    You don't need to test it because it is self evident it works

  10. #25
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,901
    Meh, there isn't much to complain about in that code. It's too small a project.
    Except for the global variables, of course. And the implicit main.
    I can't really prove anything since I refuse to run it, so I won't say anything

    Did you ever try to compile your programs as C99, the newest C standard?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #26
    Registered User
    Join Date
    Apr 2006
    Posts
    58
    Quote Originally Posted by esbo View Post
    fclose(ptr2);
    fclose(ptr3);

    Hey, at least check the fclose for any errors.

    Variable names could be a little better.
    What are gg, xx, yy, c1, c2, g1 supposed to contain? I'm not just talking about the datatypes like int or float, but what is gg? Is that a ticker symbol? Gary Glitter? Is g1 related to it?

    I used to have a friend that did this sort of thing too. I'd find in his code names of people for variable names which was just as useless. But I wasn't too harsh on him since he wasn't a programmer by trade.

    Quote Originally Posted by esbo View Post
    if (c1==c2) printf("%c %c%c %d\n", typ[g1], face[c1],face[c2], crds[c1][c2]);
    You may want to get into the habit of putting braces in all if statements regardless if there is only one line. One day you won't notice the lack of braces and you'll put in another command right after it and then you'll scratch your head wondering why the new command is executing everytime.


    It would also be a good habit to log all error messages with meaningful messages to file with an appropriate time and date stamp prefixing every logged message. "Cant open output file" doesn't help me if I am looking at it at 3 AM. What happened? Was the disk full? Was it a permissions problem? What was the fopen error message? Use strerror and errno!!

    It's obvious that you are the only one that works on this code as only the author would know what is going on.

  12. #27
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,901
    Quote Originally Posted by samf View Post
    You may want to get into the habit of putting braces in all if statements regardless if there is only one line. One day you won't notice the lack of braces and you'll put in another command right after it and then you'll scratch your head wondering why the new command is executing everytime.
    Nah, that's subjective.
    I never do it and pretty much never run into such problems.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #28
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by samf View Post
    Hey, at least check the fclose for any errors.

    Variable names could be a little better.
    What are gg, xx, yy, c1, c2, g1 supposed to contain? I'm not just talking about the datatypes like int or float, but what is gg? Is that a ticker symbol? Gary Glitter? Is g1 related to it?

    I used to have a friend that did this sort of thing too. I'd find in his code names of people for variable names which was just as useless. But I wasn't too harsh on him since he wasn't a programmer by trade.



    You may want to get into the habit of putting braces in all if statements regardless if there is only one line. One day you won't notice the lack of braces and you'll put in another command right after it and then you'll scratch your head wondering why the new command is executing everytime.


    It would also be a good habit to log all error messages with meaningful messages to file with an appropriate time and date stamp prefixing every logged message. "Cant open output file" doesn't help me if I am looking at it at 3 AM. What happened? Was the disk full? Was it a permissions problem? What was the fopen error message? Use strerror and errno!!

    It's obvious that you are the only one that works on this code as only the author would know what is going on.
    xx and yy are like x and y coordinates if you put the cards into a grid and use them to reference each pair. g1 is related to gg, gg is the code for the game type and g1 is a convient number into which it is converted. sinilarly xx is converted in to c1 and yy into c2
    cards 1 an 2 but easier to work with.

    Anyway its only a 100 line program it would be a waste of time doing anymore to it.

    Oddly enough if the first line of the input is a blank line it just goes in to an infinite loop printing invaalid card etc...
    filling the hard drive with a huge file.
    None of the error message stuff you mentioned would have helped there so it would have been a proven waste of time.
    Last edited by esbo; 01-02-2009 at 06:30 PM.

  14. #29
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by Elysia View Post
    Did you ever try to compile your programs as C99, the newest C standard?
    Based on this code:
    Code:
    main(argc,argv)
    	int  argc;
    	char *argv[]; 
    {
    I would guess he's using a prehistoric version of C that isn't even C89 standard.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  15. #30
    Fountain of knowledge.
    Join Date
    May 2006
    Posts
    794
    Quote Originally Posted by cpjust View Post
    Based on this code:
    Code:
    main(argc,argv)
    	int  argc;
    	char *argv[]; 
    {
    I would guess he's using a prehistoric version of C that isn't even C89 standard.

    The compiler don't care, the processor don't care, why should I care?

Page 2 of 4 FirstFirst 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C and C++ compile speed
    By swgh in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 01-02-2007, 02:37 PM
  2. Compile as you type
    By Rocketmagnet in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 12-07-2006, 01:36 PM
  3. How to compile mfc libs from platform sdk
    By tjcbs in forum Windows Programming
    Replies: 6
    Last Post: 11-19-2006, 08:20 AM
  4. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 09:05 PM
  5. How can I compile C or C++ with Visual Studio .NET?
    By Dakkon in forum C Programming
    Replies: 8
    Last Post: 02-11-2003, 02:58 PM

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