Thomas Hruska <[EMAIL PROTECTED]> write          赵鹏飞 wrote:
> #include<stdio.h>
> int main()
> {
> int a,b,c;
> printf("They are bidagelasi numbers\n");
> 
> for(a = 0;a <= 500;++ a){
> for(b = 0; b <= 500;++ b){
> 
> for(c = 0;c < 500;++ c){
> if((a * a == c * c + b * b){

Missing a close-parenthesis ')' on the line above (or remove the extra
open-parenthesis '(').

> printf("The three numbers are : %d%d%d\n",a,b,c);
> }
> 
> }
> 
> }
> } 
> return 0;
> }
> 
> 
> I write the programme like this ,but when I complie it ,the computer thell me
> error in function'main'
> parse error before '{'
> At top level:
> parse error before'return'

Two comments:

1) Your compiler should be capable of picking out that you are missing
a close parenthesis. If it isn't, time to get a new compiler. Visual
C++ 2005 Express is free and has the best debugger available.

2) Your code indentations are all over the place. Could just be my
mail reader but it certainly made matching the bracket pairs '{}' difficult.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task. Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



                           Thank you for your reminding me of the close 
parenthesis.When I have written it in my progamme ,the programme can be 
complied,and it ran.
   I want to changed it into another programme(show all the numbers from 1 to 
500 can be used to form an right-angled triangle)as folllow:
   
   
  
 #include<stdio.h>
#include<stdlib.h>
 int main()
  {
    int a,b,c;
  int larger;
  int smaller;
  
    printf("They are bidagelasi numbers\n");
  
  for(a = 1;a <= 500;++ a){
       for(b = 1; b <= 500;++ b){
  
        for(c = 1;c < 500;++ c){
                 
                if(b >= c){
                 larger = b ;
                 smaller = c ;
                }
                else{
                 larger = c;
                 smaller = b;
                 }   
                           
   
           if((c * c + b * b == a * a ) && (b + c > a) && (a - larger < 
smaller)){
               printf("The three numbers are : %4d%4d%4d\n",a,b,c);
     }
     
       }
    
    }
   } 
   system("pause");
   
   return 0;
  }
   
   
  
I run it ,bu it only prints part of the result that should be printed .The 
number of 'a'  only  apppears from 335 to 500.I feel puzzled ,why the numbers 
of 'a' from 1 to 334 are missing.Or my 'for loop' is totally wrong ,this 
progarmme can't be writen like this?



       
---------------------------------
雅虎邮箱,终生伙伴! 

[Non-text portions of this message have been removed]

Reply via email to