I would try qemu
link: http://wiki.qemu.org/Main_Page
Erika
Visit
25 April 2011
13 April 2011
conversione con base da 2 a 36, parte finale
conversione con base 2-36 e fino a 32768 decimale
/*
* Eri_reverse_inttobase.c
* Copyright (C) Erika 2011
*
* Eri_reverse_inttobase is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Struttura is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/* my define usualy */
#define ERI_MAX 136 /* now not use */
#define ERI_base_MAX 36
#define ERI_base_MIN 2
#define ERI_num_MAX 32768 /* max num conversion */
#define ERI_lun_MAX 17 /* max lenght string */
/* my function prototype */
int main (int, char **);
void defu (char *, int , int);
void Eri_itobase(int , char *, int, char);
void Eri_Reverse(char *);
/*
* actuality not use insert number with console, not exercise request
* change n_Eri for number convert to base, not MAX 1023
* change Eri_lcase for wrote string lower case, 'l' or not important this phase
*/
int main (int argc, char **argv)
{
char buffer[ERI_lun_MAX], Eri_lcase = 'l';
int i = 2, n_Eri = 32768;
char st_Eri[] = "void defu (char *, int)"; /* this my test, now not use */
defu (st_Eri, 0, strlen (st_Eri)); /* this not complete */
while (i < 37) { Eri_itobase(n_Eri, buffer, i, Eri_lcase); printf("> Decimal %d in base %-2d : %s\n", n_Eri, i, buffer);
++i;
}
return (0);
}
/*
* this function not complete
* now only reverse string
*/
void defu (char *s, int i, int f)
{
printf ("<%s>, %d - %d\n", s, i, f);
Eri_Reverse(s);
printf ("<%s>, %d - %d\n", s, f, i);
}
/*
* convert n to base b, wrote in to s string and call reverse function s string
* variable a test for lower or upper case, only test for 'l', another ONLY upper letter
* test if b minor 2 or major 36, if yes exit
* test if n major 1023, if yes exit
*
*/
void Eri_itobase(int n, char *s, int b, char a)
{
static char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i = 0, sign;
if ( b < ERI_base_MIN || b > ERI_base_MAX )
{
fprintf(stderr, "Error Eri_base_MIN&MAX: for my exercise MIN 2 MAX 36 not [%d]\n", b);
exit(EXIT_FAILURE); /* to stdlib definition */
}
if (n > ERI_num_MAX)
{
fprintf(stderr, "Error Eri_num_MAX: for my exercise MAX %d not [%d]\n", ERI_num_MAX, n);
exit(EXIT_FAILURE); /* to stdlib definition */
}
if ((sign = n) < 0) n = -n; do { if (a == 'l') /* test if lower case alpha, include ctype.h */ s[i++] = tolower (digits[n % b]); else s[i++] = digits[n % b]; } while ((n /= b) > 0);
if (sign < 0)
s[i++] = '-';
s[i] = '\0';
Eri_Reverse(s);
}
/* Eri_Reverse, reverses string s[] in place */
void Eri_Reverse(char *s)
{
int c, i, j;
for ( i = 0, j = strlen(s)-1; i < j; i++, j--) {
c = s[i];
s[i] = s[j];
s[j] = c;
}
}
/*
* Eri_reverse_inttobase.c
* Copyright (C) Erika 2011
*
* Eri_reverse_inttobase is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Struttura is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/* my define usualy */
#define ERI_MAX 136 /* now not use */
#define ERI_base_MAX 36
#define ERI_base_MIN 2
#define ERI_num_MAX 32768 /* max num conversion */
#define ERI_lun_MAX 17 /* max lenght string */
/* my function prototype */
int main (int, char **);
void defu (char *, int , int);
void Eri_itobase(int , char *, int, char);
void Eri_Reverse(char *);
/*
* actuality not use insert number with console, not exercise request
* change n_Eri for number convert to base, not MAX 1023
* change Eri_lcase for wrote string lower case, 'l' or not important this phase
*/
int main (int argc, char **argv)
{
char buffer[ERI_lun_MAX], Eri_lcase = 'l';
int i = 2, n_Eri = 32768;
char st_Eri[] = "void defu (char *, int)"; /* this my test, now not use */
defu (st_Eri, 0, strlen (st_Eri)); /* this not complete */
while (i < 37) { Eri_itobase(n_Eri, buffer, i, Eri_lcase); printf("> Decimal %d in base %-2d : %s\n", n_Eri, i, buffer);
++i;
}
return (0);
}
/*
* this function not complete
* now only reverse string
*/
void defu (char *s, int i, int f)
{
printf ("<%s>, %d - %d\n", s, i, f);
Eri_Reverse(s);
printf ("<%s>, %d - %d\n", s, f, i);
}
/*
* convert n to base b, wrote in to s string and call reverse function s string
* variable a test for lower or upper case, only test for 'l', another ONLY upper letter
* test if b minor 2 or major 36, if yes exit
* test if n major 1023, if yes exit
*
*/
void Eri_itobase(int n, char *s, int b, char a)
{
static char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i = 0, sign;
if ( b < ERI_base_MIN || b > ERI_base_MAX )
{
fprintf(stderr, "Error Eri_base_MIN&MAX: for my exercise MIN 2 MAX 36 not [%d]\n", b);
exit(EXIT_FAILURE); /* to stdlib definition */
}
if (n > ERI_num_MAX)
{
fprintf(stderr, "Error Eri_num_MAX: for my exercise MAX %d not [%d]\n", ERI_num_MAX, n);
exit(EXIT_FAILURE); /* to stdlib definition */
}
if ((sign = n) < 0) n = -n; do { if (a == 'l') /* test if lower case alpha, include ctype.h */ s[i++] = tolower (digits[n % b]); else s[i++] = digits[n % b]; } while ((n /= b) > 0);
if (sign < 0)
s[i++] = '-';
s[i] = '\0';
Eri_Reverse(s);
}
/* Eri_Reverse, reverses string s[] in place */
void Eri_Reverse(char *s)
{
int c, i, j;
for ( i = 0, j = strlen(s)-1; i < j; i++, j--) {
c = s[i];
s[i] = s[j];
s[j] = c;
}
}
12 April 2011
exercise numero in base
/*
* main_phase_3.c
* Copyright (C) Erika 2011
*
* Struttura is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Struttura is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/* my define usualy */
#define ERI_MAX 136 /* now not use */
#define ERI_base_MAX 36
#define ERI_base_MIN 2
#define ERI_num_MAX 1023
/* my function prototype */
int main (int, char **);
void defu (char *, int , int);
void Eri_itobase(int , char *, int, char);
void Eri_Reverse(char *);
/*
* actuality not use insert number with console, not exercise request
* change n_Eri for number convert to base, not MAX 1023
* change Eri_lcase for wrote string lower case, 'l' or not important this phase
*/
int main (int argc, char **argv)
{
char buffer[10], Eri_lcase = 'l';
int i = 2, n_Eri = 37;
char st_Eri[] = "void defu (char *, int)"; /* this my test, now not use */
defu (st_Eri, 0, strlen (st_Eri)); /* this not complete */
while (i < 37)
{
Eri_itobase(n_Eri, buffer, i, Eri_lcase);
printf("> Decimal %d in base %-2d : %s\n", n_Eri, i, buffer);
++i;
}
return (0);
}
/*
* this function not complete
*/
void defu (char *s, int i, int f)
{
printf ("<%s>, %d - %d\n", s, i, f);
}
/*
* convert n to base b, wrote in to s string and call reverse function s string
* variable a test for lower or upper case, only test for 'l', another ONLY upper letter
* test if b minor 2 or major 36, if yes exit
* test if n major 1023, if yes exit
*
*/
void Eri_itobase(int n, char *s, int b, char a)
{
static char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i = 0, sign;
if ( b < ERI_base_MIN || b > ERI_base_MAX )
{
fprintf(stderr, "Error Eri_base_MIN&MAX: for my exercise MIN 2 MAX 36 not [%d]\n", b);
exit(EXIT_FAILURE); /* to stdlib definition */
}
if (n > ERI_num_MAX)
{
fprintf(stderr, "Error Eri_num_MAX: for my exercise MAX 1023 not [%d]\n", n);
exit(EXIT_FAILURE); /* to stdlib definition */
}
if ((sign = n) < 0)
n = -n;
do {
if (a == 'l') /* test if lower case alpha, include ctype.h */
s[i++] = tolower (digits[n % b]);
else
s[i++] = digits[n % b];
} while ((n /= b) > 0);
if (sign < 0)
s[i++] = '-';
s[i] = '\0';
Eri_Reverse(s);
}
/* Eri_Reverse, reverses string s[] in place */
void Eri_Reverse(char *s)
{
int c, i, j;
for ( i = 0, j = strlen(s)-1; i < j; i++, j--) {
c = s[i];
s[i] = s[j];
s[j] = c;
}
}
* main_phase_3.c
* Copyright (C) Erika 2011
*
* Struttura is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Struttura is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/* my define usualy */
#define ERI_MAX 136 /* now not use */
#define ERI_base_MAX 36
#define ERI_base_MIN 2
#define ERI_num_MAX 1023
/* my function prototype */
int main (int, char **);
void defu (char *, int , int);
void Eri_itobase(int , char *, int, char);
void Eri_Reverse(char *);
/*
* actuality not use insert number with console, not exercise request
* change n_Eri for number convert to base, not MAX 1023
* change Eri_lcase for wrote string lower case, 'l' or not important this phase
*/
int main (int argc, char **argv)
{
char buffer[10], Eri_lcase = 'l';
int i = 2, n_Eri = 37;
char st_Eri[] = "void defu (char *, int)"; /* this my test, now not use */
defu (st_Eri, 0, strlen (st_Eri)); /* this not complete */
while (i < 37)
{
Eri_itobase(n_Eri, buffer, i, Eri_lcase);
printf("> Decimal %d in base %-2d : %s\n", n_Eri, i, buffer);
++i;
}
return (0);
}
/*
* this function not complete
*/
void defu (char *s, int i, int f)
{
printf ("<%s>, %d - %d\n", s, i, f);
}
/*
* convert n to base b, wrote in to s string and call reverse function s string
* variable a test for lower or upper case, only test for 'l', another ONLY upper letter
* test if b minor 2 or major 36, if yes exit
* test if n major 1023, if yes exit
*
*/
void Eri_itobase(int n, char *s, int b, char a)
{
static char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int i = 0, sign;
if ( b < ERI_base_MIN || b > ERI_base_MAX )
{
fprintf(stderr, "Error Eri_base_MIN&MAX: for my exercise MIN 2 MAX 36 not [%d]\n", b);
exit(EXIT_FAILURE); /* to stdlib definition */
}
if (n > ERI_num_MAX)
{
fprintf(stderr, "Error Eri_num_MAX: for my exercise MAX 1023 not [%d]\n", n);
exit(EXIT_FAILURE); /* to stdlib definition */
}
if ((sign = n) < 0)
n = -n;
do {
if (a == 'l') /* test if lower case alpha, include ctype.h */
s[i++] = tolower (digits[n % b]);
else
s[i++] = digits[n % b];
} while ((n /= b) > 0);
if (sign < 0)
s[i++] = '-';
s[i] = '\0';
Eri_Reverse(s);
}
/* Eri_Reverse, reverses string s[] in place */
void Eri_Reverse(char *s)
{
int c, i, j;
for ( i = 0, j = strlen(s)-1; i < j; i++, j--) {
c = s[i];
s[i] = s[j];
s[j] = c;
}
}
06 April 2011
comandi in Terminale, Linux Mint
apt-get -f install
questo comando dovrebbe risolvere i vari conflitti per la gestione sia per gli aggiornamenti che per eventuali errori
questo comando dovrebbe risolvere i vari conflitti per la gestione sia per gli aggiornamenti che per eventuali errori
03 March 2011
begin Bash Script
this is an easy approach to Bash Script
for students of chemistry and mathematics, and certainly not programmers
for students of chemistry and mathematics, and certainly not programmers
Subscribe to:
Posts (Atom)