+ Responder ao Tópico



  1. #1
    Under-linux.Org Team Avatar de MarcusMaciel
    Ingresso
    Dec 2000
    Localização
    Boston
    Posts
    1.961
    Posts de Blog
    44

    Padrão highlight teste

    teste
    Código python:
    #!/usr/local/bin/python
     
    import string, sys
     
    # If no arguments were given, print a helpful message
    if len(sys.argv)==1:
        print 'Usage: celsius temp1 temp2 ...'
        sys.exit(0)
     
    # Loop over the arguments
    for i in sys.argv[1:]:
        try: 
            fahrenheit=float(string.atoi(i))
        except string.atoi_error:
    	print repr(i), "not a numeric value"
        else:
    	celsius=(fahrenheit-32)*5.0/9.0
    	print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))

  2. #2
    Under-linux.Org Team Avatar de MarcusMaciel
    Ingresso
    Dec 2000
    Localização
    Boston
    Posts
    1.961
    Posts de Blog
    44

    Padrão

    antes que alguem fale algo isso e um teste..

  3. #3
    Under-linux.Org Team Avatar de MarcusMaciel
    Ingresso
    Dec 2000
    Localização
    Boston
    Posts
    1.961
    Posts de Blog
    44

    Padrão Re: highlight teste

    Código c:
    #include 
    #include 
     
    #define MAX_BUF 120
     
    int main(int argc, char* argv[])
    {
    	FILE *f;
    	int n1=0;
    	int n2=0;
    	char filename[80];
    	char buf[MAX_BUF];
     
    	printf("Indique nome do ficheiro:");
    	gets(filename);
     
    	f=fopen(filename,"r");
    	if (f==NULL) 
    	{
    		printf("Erro na abertura do ficheiro");
    		return 1;
    	}
    	while (! feof(f)) 
    	{
    		fgets(buf,MAX_BUF, f);
    		n1++;
    		if (strstr(buf, "printf")>0) {
    			n2++;
    			printf("> %s", buf);
    		}
    		else
    			printf("* %s", buf);
    	}
    	fclose(f);
    	printf("\n\nO ficheiro tem %d linhas, das quais %d com \"printf\"\n",n1,n2);
    	return 0;
    }

  4. #4
    MODERADOR-CHEFE Avatar de osmano807
    Ingresso
    Aug 2008
    Localização
    Araguari - Minas Gerais
    Posts
    1.980
    Posts de Blog
    5

    Padrão Re: highlight teste

    Código c++:
     
    // function template
    #include <iostream>
    using namespace std;
     
    template <class T>
    T GetMax (T a, T b) {
      T result;
      result = (a>b)? a : b;
      return (result);
    }
     
    int main () {
      int i=5, j=6, k;
      long l=10, m=5, n;
      k=GetMax<int>(i,j);
      n=GetMax<long>(l,m);
      cout << k << endl;
      cout << n << endl;
      return 0;
    }

    Faltou template, sugerir isso pra eles depois
    Última edição por osmano807; 01-09-2010 às 18:08.

  5. #5
    Moderador Avatar de Bruno
    Ingresso
    Nov 2002
    Localização
    Guarapuava-PR
    Posts
    4.181
    Posts de Blog
    1

    Padrão Re: highlight teste

    Código PHP:
    <?php
    if($var =="1"){
    echo 
    "Variavel igual a 1";
    }else{
    echo 
    "Variavel diferente de 1";
    }
    ?>
    Última edição por Bruno; 02-09-2010 às 10:28.

  6. #6
    xargs -n 1 kill -9 Avatar de sergio
    Ingresso
    Jan 2004
    Localização
    Capital do Triângulo
    Posts
    5.201
    Posts de Blog
    9

    Padrão Re: highlight teste

    Código lua:
    cgilua.htmlheader()
        write('<html>')
        if (cgi.language == 'english') then
           greeting = 'Hello World!‘
        elseif (cgi.language == 'portuguese') then
           greeting = 'Olá Mundo!'
        else
           greeting = '[unknown language]'
        end
           write('<head><title>'..greeting..'</title></head>')
           write('<body>')
           write('<b>'..greeting..'</b>')
           write('</body>')
           write('</html>')
    Última edição por sergio; 02-09-2010 às 09:32.

  7. #7

    Padrão Re: highlight teste

    Boa \o/