code stringlengths 0 21.5M | repo_name stringlengths 4 92 | path stringlengths 1 189 | language stringlengths 0 26 | license stringclasses 11
values | size int64 0 21.5M |
|---|---|---|---|---|---|
namespace Nico {
/**
* Errors that may occur when working with a {@link Nico.Client}
*/
public errordomain ClientError {
UNKNOWN_LOCATION
}
/**
* A generic Client to smoking Servers
*/
public class Client : GLib.Object {
private Socket connection;
private... | grindhold/nico | src/client.vala | vala | unknown | 8,535 |
namespace Nico {
[GtkTemplate (ui='main.ui')]]
class Client : Box {
[GtkChild]
private ScrolledWindow session_list;
[GtkChild]
public Client(string[] argv) {
var c = new Client("localhost", 8477, GLib.Environment.get_user_name());
... | grindhold/nico | src/clientapp.vala | vala | unknown | 819 |
namespace Nico {
public class ConnectionHandler : GLib.Object {
private Server server;
private GLib.Socket connection;
private string username = "";
public ConnectionHandler(Server s, GLib.Socket con) {
this.server = s;
this.connection = con;
try ... | grindhold/nico | src/connection_handler.vala | vala | unknown | 5,924 |
namespace Nico {
public class Server : GLib.Object {
private GLib.Socket socket;
private List<Session> sessions;
private int session_id = 1;
private List<string> locations;
private List<ConnectionHandler> connections;
public Server() {
this.locations = ne... | grindhold/nico | src/server.vala | vala | unknown | 3,985 |
namespace Nico {
public static void main(string[] argv) {
new Server();
}
}
| grindhold/nico | src/serverapp.vala | vala | unknown | 92 |
namespace Nico{
public enum Messages {
HELO = 0x1,
INIT = 0x2,
CREATE = 0x3,
UPDATE = 0x4,
ACK = 0x5,
NACK = 0x6
}
public class Resources : GLib.Object {
public bool tabak {get; set; default=false;}
public bool filter {get; set; default=false;}
p... | grindhold/nico | src/types.vala | vala | unknown | 3,355 |
Sim. O compilador avisa que a função `main` não retorna
nenhum valor. A correção necessária seria usar `return`
ou `exit`.
| urukhai/c | 2/exercicios/1.txt | Text | unknown | 129 |
a.
Diretivas (sempre começam com #, são processadas pelo
pré-processador):
#include <stdio.h>
Afirmações (comandos a serem executados quando o programa
é executado):
printf, return
b.
Parkinson's Law:
Work expands so as to fill the time
avaliable for its completion.
| urukhai/c | 2/exercicios/2.txt | Text | unknown | 275 |
#include <stdio.h>
int
main(void)
{
int height = 8, lenght = 12, width = 10;
int volume = height * lenght * width;
printf("Dimensions: %dx%dx%d\n", lenght, width, height);
printf("Volume (cubic inches): %d\n", volume);
printf("Dimensional weight (pounds): %d\n", (volume + 165) / 166);
return 0;
}
| urukhai/c | 2/exercicios/3.c | C++ | unknown | 309 |
#include <stdio.h>
int
main(void)
{
int a, b, c;
float d, e, f;
printf("%d, %d, %d\n", a, b, c);
printf("%f, %f, %f\n", d, e, f);
return 0;
}
| urukhai/c | 2/exercicios/4.c | C++ | unknown | 153 |
O único padrão observável é que as variáveis do tipo
float são impressas como 0, seguido de 6 casas decimais.
Quanto ao tipo int, o primeiro valor é um inteiro alto,
enquanto nos outros dois verifica-se 0 como saída.
| urukhai/c | 2/exercicios/4.txt | Text | unknown | 225 |
a. 100_bottles
Inválido, pois o primeiro caracter é um número.
b. _100_bottles
Válido, pois o primeiro dígito é um traço baixo.
c. one__hundred__bottles
Válido.
d. bottles_by_the_hundred_
Válido, mesmo terminando em _.
| urukhai/c | 2/exercicios/5.txt | Text | unknown | 231 |
Porque normalmente essa nomenclatura é reservada para a
implementação i.e bibliotecas, o que pode levar à colisões.
| urukhai/c | 2/exercicios/6.txt | Text | unknown | 121 |
a.
Keyword for, é um laço.
b.
C é sensível ao caso, logo If != if, o que torna este um
keyword e aquele não.
c.
main é a única função obrigatória, mas não é um keyword.
d.
printf é uma função totalmente arbitrária.
e.
while é reservado, pois é um tipo de estrutura de repetição.
| urukhai/c | 2/exercicios/7.txt | Text | unknown | 303 |
#include <stdio.h>
int
main(void)
{
printf(" *\n");
printf(" * \n");
printf(" * \n");
printf("* * \n");
printf(" * * \n");
printf(" * \n");
return 0;
}
| urukhai/c | 2/projetos/1.c | C++ | unknown | 208 |
#include <stdio.h>
#define PI 3.141f
int
main(void)
{
int radius;
float volume;
radius = 10;
volume = (4.0f/3.0f)*PI*(radius*radius*radius);
printf("Volume: %0.3f\n", volume);
return 0;
}
| urukhai/c | 2/projetos/2.c | C++ | unknown | 200 |
#include <stdio.h>
#define PI 3.141f
int
main(void)
{
int radius;
float volume;
puts("Enter the radius of the sphere:");
scanf("%d", &radius);
volume = (4.0f/3.0f)*PI*(radius*radius*radius);
printf("Volume: %0.3f\n", volume);
return 0;
}
| urukhai/c | 2/projetos/3.c | C++ | unknown | 252 |
#include <stdio.h>
int
main(void)
{
float tax_added, value;
puts("Enter an amount:");
scanf("%f", &value);
tax_added = value + (value * 0.05f);
printf("With the tax added: $%0.2f\n", tax_added);
return 0;
}
| urukhai/c | 2/projetos/4.c | C++ | unknown | 219 |
#include <stdio.h>
#include <math.h>
int
main(void)
{
float x, expression;
puts("Enter x value:");
scanf("%f", &x);
// expression = 3.0f * (x * x * x * x * x) + 2.0f * (x * x * x * x)
// - 5.0f * (x * x * x) - (x * x) + 7.0f * (x) - 6.0f;
expression = 3.0f * (powf(x, 5.0f)) + 2.0f * (powf(x, 4.0f)) -
5.... | urukhai/c | 2/projetos/5-a.c | C++ | unknown | 447 |
#include <stdio.h>
int
main(void)
{
float x, expression;
puts("Enter x value:");
scanf("%f", &x);
expression = 3.0f * (x * x * x * x * x) + 2.0f * (x * x * x * x)
- 5.0f * (x * x * x) - (x * x) + 7.0f * (x) - 6.0f;
printf("Result of the expression: %f\n", expression);
return 0;
}
| urukhai/c | 2/projetos/5.c | C++ | unknown | 298 |
#include <stdio.h>
int
main(void)
{
float x, expression;
puts("Enter x value:");
scanf("%f", &x);
expression = ((((3.0f * x + 2.0f)* x - 5.0f) * x - 1.0f) \
* x + 7.0f) * x - 6.0f;
printf("Result of the expression: %f\n", expression);
return 0;
}
| urukhai/c | 2/projetos/6.c | C++ | unknown | 263 |
#include <stdio.h>
int
main(void)
{
int amount, twenty, ten, five, one;
puts("Enter a integer dollar amount:");
scanf("%d", &amount);
twenty = amount/20;
amount = amount - (twenty*20);
ten = amount/10;
amount = amount - (ten*10);
five = amount/5;
amount = amount - (five*5);
... | urukhai/c | 2/projetos/7.c | C++ | unknown | 484 |
#include <stdio.h>
int
main(void)
{
double loan, rate, m_rate, m_payment, balance;
double first, second, third;
puts("Enter amount of loan:");
scanf("%lf", &loan);
puts("Enter interest rate:");
scanf("%lf", &rate);
puts("Enter monthly payment:");
scanf("%lf", &m_payment);
m_rat... | urukhai/c | 2/projetos/8.c | C++ | unknown | 667 |
CFLAGS = -Weverything -std=c99 -pedantic
CC = clang
SRC = $(wildcard *)
SRCS = $(wildcard *.c)
PROGS = $(patsubst %.c,%,$(SRCS))
all: $(PROGS)
%: %.c
$(CC) $(CFLAGS) -o $@ $<
clean:
rm -f $(PROGS)
| urukhai/c | 2/projetos/Makefile | Makefile | unknown | 210 |
a.
86,1040
Seis caracteres "alocados" para 86, dos quais quatro são
vazios e os dois últimos o número.
Para 1040, quatro alocados e quatro preenchidos.
b.
3.02530e+01
12 "alocados" para o valor inteiro, 5 para os após o
ponto.
c.
83.1620
Quatro alocados para o valor decimal. .162 -> 1620
d.
1e-06
| urukhai/c | 3/exercicios/1.txt | Text | unknown | 310 |
#include <stdio.h>
int main(void)
{
float x;
x = 0.0000048392333;
printf("<%-8.1e>\n", x);
printf("<%10.6e>\n", x);
printf("<%-8.3f>\n", x);
printf("<%6.0f>\n", x);
return 0;
}
| urukhai/c | 3/exercicios/2.c | C++ | unknown | 214 |
a.
É equivalente.
b.
É equivalente, pois os espaços estão entre os formatadores.
c.
São diferentes, pois a "%f " significa que o usuário deve
entrar com um espaço em branco no final da string para
casá-la, enquanto que "%f" apenas exigiria a entrada.
d.
Equivalentes.
| urukhai/c | 3/exercicios/3.txt | Text | unknown | 279 |
#include <stdio.h>
int
main(void)
{
int i, j;
float x;
scanf("%d%f%d", &i, &x, &j);
printf("%d %f %d \n", i, x, j);
return 0;
}
| urukhai/c | 3/exercicios/4.c | C++ | unknown | 152 |
int i, j;
float x;
scanf("%d%f%d", &i, &x, &j);
user input: 10.3 5 6
i é do tipo inteiro, logo, assim que a scanf começar a "varredura", guardará 10 nessa variável.
Ao encontrar .3, scanf armazena o valor em x como 0.3.
5 é guardado em j.
6 é ignorado.
| urukhai/c | 3/exercicios/4.txt | Text | unknown | 264 |
int i;
float x, y;
scanf("%f%d%f, &x, &i, &y);
user input:
12.3 45.6 789
x receberá 12.3.
i sendo inteiro armazenará 45.
y <- 0.6
| urukhai/c | 3/exercicios/5.txt | Text | unknown | 134 |
#include <stdio.h>
int
main(void)
{
int num1, denom1, num2, denom2, result_num, result_denom;
puts("Enter first fraction:");
scanf("%d / %d", &num1, &denom1);
puts("Enter second fraction:");
scanf("%d / %d", &num2, &denom2);
result_num = num1 * denom2 + num2 * denom1;
result_denom = den... | urukhai/c | 3/exercicios/6.c | C++ | unknown | 411 |
#include <stdio.h>
int
main(void)
{
int day, month, year;
puts("Enter a date (mm/dd/yyyy):");
scanf("%d/%d/%d", &month, &day, &year);
printf("You entered the date: %.4d%.2d%.2d\n", year, month, day);
return 0;
}
| urukhai/c | 3/projetos/1.c | C++ | unknown | 237 |
#include <stdio.h>
int
main(void)
{
int item_number, day, month, year;
float unit_price;
puts("Enter item number:");
scanf("%d", &item_number);
puts("Enter unit price:");
scanf("%f", &unit_price);
puts("Enter purchase date (mm/dd/yyyy):");
scanf("%d/%d/%d", &month, &day, &year);
... | urukhai/c | 3/projetos/2.c | C++ | unknown | 515 |
#include <stdio.h>
int
main(void)
{
int gs1, group_id, publisher_code, item_n, check_dig;
puts("Enter ISBN:");
scanf("%d-%d-%d-%d-%d", &gs1, &group_id, \
&publisher_code, &item_n, &check_dig);
printf("GS1 prefix: %d\n", gs1);
printf("Group identifier: %d\n", group_id);
printf("P... | urukhai/c | 3/projetos/3.c | C++ | unknown | 461 |
#include <stdio.h>
int
main(void)
{
int area_code, a, b;
puts("Enter hone number [(xxx) xxx-xxxx]:");
scanf("(%d) %d-%d", &area_code, &a, &b);
printf("You entered %.3d.%.3d.%.4d\n", area_code, a, b);
return 0;
}
| urukhai/c | 3/projetos/4.c | C++ | unknown | 238 |
#include <stdio.h>
int
main(void)
{
int n1, n2, n3, n4, n5, n6, n7, n8, \
n9, n10, n11, n12, n13, n14, n15, n16;
puts("Enter the numbers from 1 to 16 in any order:");
scanf("%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d", &n1, &n2, &n3, \
&n4, &n5, &n6, &n7, &n8, &n9, &n10, &n11, &n12, \
... | urukhai/c | 3/projetos/5.c | C++ | unknown | 876 |
#include <stdio.h>
int
main(void)
{
int num1, denom1, num2, denom2, result_num, result_denom;
puts("Enter two fractions separated by a plus sign:");
scanf("%d/%d+%d/%d", &num1, &denom1, &num2, &denom2);
result_num = num1 * denom2 + num2 * denom1;
result_denom = denom1 * denom2;
printf("The ... | urukhai/c | 3/projetos/6.c | C++ | unknown | 381 |
CFLAGS = -Weverything -std=c99 -pedantic
CC = clang
SRC = $(wildcard *)
SRCS = $(wildcard *.c)
PROGS = $(patsubst %.c,%,$(SRCS))
all: $(PROGS)
%: %.c
$(CC) $(CFLAGS) -o $@ $<
clean:
rm -f $(PROGS)
| urukhai/c | 3/projetos/Makefile | Makefile | unknown | 210 |
a.
5/3, 5%3 -> 1, 2
b.
(2+10) % 3 -> 0
c.
(7+10) % 9 / 8 -> 17 % 9 / 8 -> 1
d.
(1+5) % (2+2) / 3 -> 6 % 4 / 3 -> 0
| urukhai/c | 4/exercicios/1.txt | Text | unknown | 118 |
a.
i = 6;
j = i += i;
j = i = 6 + 6 -> j = 12
i = 12
b.
i = 5;
j = (i -= 2) + 1;
j = (i = 5 - 2) + 1 -> j = (3) + 1 = 4
i = 3
c.
i = 7;
j = 6 + (i = 2.5) -> 6 + 2.5 = 8.5 -> 9
i = 2.5 -> 2
d.
i = 2; j = 8;
j = (i = 6) + (j = 3) -> 9
i = 6
| urukhai/c | 4/exercicios/10.txt | Text | unknown | 243 |
a.
i = 1;
printf("%d ", i++ - 1); -> 0
printf"%d", i); -> 2
b.
i = 10; j = 5;
printf("%d ", i++ - ++j); -> 10 - 6 = 4
printf("%d %d", i, j); -> 11 6
c.
i = 7; j = 8;
printf("%d ", i++ - --j); -> 7 - 7 = 0
printf("%d %d", i, j); -> 8 9
d.
i = 3; j = 4; k = 5;
printf("%d ", i++ - j++ + --k); -> 3 - 4 + 4 = 3
printf("%... | urukhai/c | 4/exercicios/11.txt | Text | unknown | 351 |
a.
i = 5;
j = ++i * 3 - 2; -> j = 6 * 3 - 2 = 16
printf("%d %d", i, j); -> 6, 16
b.
i = 5;
j = 3 - 2 * i++; -> 3 - 2 * 5 = -7
printf("%d %d", i, j); -> 6 -7
c.
i = 7.
j = 3 * i-- + 2; -> 3 * 7 + 2 = 23
printf("%d %d", i, j); -> 6 23
d.
i = 7;
j = 3 + --i * 2; -> 3 + 6 * 2 = 15
printf("%d %d", i, j); -> 6, 15
| urukhai/c | 4/exercicios/12.txt | Text | unknown | 317 |
++i, pois incrementa a variável na mesma declaração.
| urukhai/c | 4/exercicios/13.txt | Text | unknown | 56 |
a.
a * b - c * d + e;
(a * b) - (c *d ) + e;
b.
a / b % c / d;
(((a / b) % c) / d);
c.
- a - b + c - + d;
((-a) - b + c - (+d));
d.
a * -b / c - d;
(((a * (-b)) / c) - d)
| urukhai/c | 4/exercicios/14.txt | Text | unknown | 173 |
i = 1;
j = 2;
a.
i += j; -> i = i + j -> i = 1 + 2
i = 3
j = 2
b.
i--;
i = 0
j = 2
c.
i * j / i;
(i * j) / i -> 2/1 = 1
j = 2
d.
i % ++j;
1 % 2 -> 1, 3
| urukhai/c | 4/exercicios/15.txt | Text | unknown | 156 |
(-i)/j nem sempre é igual a - (i/j), a depender da
implementação: c89 pode produzir -1 ou -2, enquanto que
em c99 a expressão seria equivalente.
| urukhai/c | 4/exercicios/2.txt | Text | unknown | 149 |
a.
8 / 5 = 1.6
b.
-8 / 5 = -1.6 ou -2
c.
8 / -5 = -1.6 ou -2
d.
-8 / -5 = 1.6 ou 2
| urukhai/c | 4/exercicios/3.txt | Text | unknown | 86 |
a.
8 / 5 = 1.6
b.
-8 / 5 = -1.6
c.
8 / -5 = -1.6
d.
-8 / -5 = 1.6
| urukhai/c | 4/exercicios/4.txt | Text | unknown | 69 |
a.
8 % 5 = 3
b.
-8 % 5 = -3 ou 5
c.
8 % -5 = -3 ou -5
d.
-8 % -5 = 3 ou 5
| urukhai/c | 4/exercicios/5.txt | Text | unknown | 77 |
a.
8 % 5 = 3
b.
-8 % 5 = -3
c.
8 % -5 = -3
d.
-8 % -5 = 3
| urukhai/c | 4/exercicios/6.txt | Text | unknown | 61 |
A versão "simplificada" produziria um check digit de 10,
o que não é válido.
| urukhai/c | 4/exercicios/7.txt | Text | unknown | 81 |
Sim, funcionaria.
| urukhai/c | 4/exercicios/8.txt | Text | unknown | 18 |
a.
i = 7; j = 8;
i *= j + 1;
printf("%d %d", i, j);
i = 7 * 8 + 1 -> 63
63 8
b.
i = j = k = 1;
i += j += k;
printf("%d %d %d", i, j, k);
i += j = j + k -> i += j = 1 + 1 -> i += j = 2 -> i = 1 + 2 = 3
j = 2
k = 1
c.
i = 1; j = 2; k = 3;
i -= j -= k -> i -= j = 2 - 3 -> i = 1 - (-1) = 2
j = -1
k = 3
d.
i = 2; j = 1... | urukhai/c | 4/exercicios/9.txt | Text | unknown | 389 |
#include <stdio.h>
int
main(void)
{
int type, i1, i2, i3, i4, i5, j1, j2, j3, j4, j5, check;
puts("Enter the first (single) digit:");
scanf("%d", &type);
puts("Enter first group of five digits:");
scanf("%1d%1d%1d%1d%1d", &i1, &i2, &i3, &i4, &i5);
puts("Enter second group of five digits:")... | urukhai/c | 4/exercicios/upc.c | C++ | unknown | 542 |
#include <stdio.h>
int
main(void)
{
int first, last, number;
puts("Enter a two-digit number:");
scanf("%2d", &number);
first = number / 10;
last = number % 10;
printf("The reversal is: %d%d\n", last, first);
return 0;
}
| urukhai/c | 4/projetos/1.c | C++ | unknown | 258 |
#include <stdio.h>
int
main(void)
{
int first, middle, last, number;
puts("Enter a three-digit number:");
scanf("%3d", &number);
first = number / 100;
last = number % 10;
middle = (number - (first * 100) - last) / 10;
/* shorter expression:
* number = (number / 10 ) % 10;
... | urukhai/c | 4/projetos/2.c | C++ | unknown | 403 |
#include <stdio.h>
int
main(void)
{
int first, middle, last;
printf("Enter the three-digit number:\n");
scanf("%1d%1d%1d", &last, &middle, &first);
printf("The reversal is: %d%d%d\n", first, middle, last);
return 0;
}
| urukhai/c | 4/projetos/3.c | C++ | unknown | 246 |
#include <stdio.h>
int
main(void)
{
int n1, n2, n3, n4, n5, number;
printf("Enter a number between 0 and 32767:\n");
scanf("%d", &number);
n5 = number % 8;
n4 = (number / 8) % 8;
n3 = (number / 64) % 8;
n2 = (number / 512) % 8;
n1 = (number / 4096) % 8;
printf("In octal, your num... | urukhai/c | 4/projetos/4.c | C++ | unknown | 394 |
#include <stdio.h>
int
main(void)
{
int type, i1, i2, i3, i4, i5, j1, j2, j3, j4, j5, check;
puts("Enter the first 11 of a UPC:");
scanf("%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d", \
&type, &i1, &i2, &i3, &i4, &i5, \
&j1, &j2, &j3, &j4, &j5 );
check = 9 - (((((type + i2 + j1 + j3 +... | urukhai/c | 4/projetos/5.c | C++ | unknown | 442 |
#include <stdio.h>
int
main(void)
{
int check, i1, i2, i3, i4, i5, i6, i7, i8,\
i9, i10, i11, i12, first_sum, second_sum;
printf("Enter the 12 digits of an EAN:\n");
scanf("%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d", \
&i1, &i2, &i3, &i4, &i5, &i6, \
&i7, &i8, &i9, &i10, &i11, ... | urukhai/c | 4/projetos/6.c | C++ | unknown | 550 |
CFLAGS = -Weverything -std=c99 -pedantic
CC = clang
SRC = $(wildcard *)
SRCS = $(wildcard *.c)
PROGS = $(patsubst %.c,%,$(SRCS))
all: $(PROGS)
%: %.c
$(CC) $(CFLAGS) -o $@ $<
clean:
rm -f $(PROGS)
| urukhai/c | 4/projetos/Makefile | Makefile | unknown | 210 |