c

Exponentiation modulo without overflows

How to raise a number to a power modulo without overflows in multiplications at a speed not worse than binary exponentiation, ... overflow-free option is to use the built-in 128-bit types supported by some compilers. Minus - not according to the standard.

GTK3 and pressing the keyboard "C-GNU / LINUX"

How in GTK can I get the value of the pressed key (which key the user pressed) and then display it on the screen? As far as ... &i); __чтобы в переменную "i" помещалась буква которую я нажал__ g\_printf("button-press-event, %i \n", i); }

Output of an escape sequence from a variable

There is a string that is taken from the file, and it contains escape sequences, for example: char *ptr="bla \n bla"! If prin ... o output hb standard output exactly as a string in C and C++ For example, in python it would look like this print(repr(ptr))

Is the order of evaluation of the arguments in the function call guaranteed?

For example, I have a function call like this: std::unique_ptr tmp{new MyClassWithNameFunction}; foo(tmp->name(), std::move(tmp)); Is it guaranteed that calling the {[1] method]} will occur first?

Duplicate each letter of the word in C

Enter your first name, last name, and patronymic in the row. You need to take the name, duplicate each letter, and then shove ... s[i] = s[i] * 2; if (s[i] != " ") { break; } } printf("%s", s); return 0; }

Linux. Xlib. Draw a transparent rectangle inside the window

The global goal is to draw a simple orange border on the desktop, something like this: The idea behind my implementation is ... window? Something I could not find on the Internet examples or xlib tools that can be applied to solve this problem problems.

Given an integer n(entered from the keyboard). Calculate the sum of n terms

Task: Given an integer n (entered from the keyboard). Calculate the sum of n terms: #define _CRT_SECURE_NO_WARNINGS #include ... an into the problem that in m I output m=0 and it does not change. What could be wrong? I do the addition of m + some number.

You need to replace the ungetc function with another function that is not related to the c ci/o c++stream

#include <stdio.h> #include <iostream> double number(){ // считываем число int res = 0; for (;;)//бескон ... порядку printf("Result= %0.3f", r);//результат } The teacher forbade the use of streams, that is, ungetc is not suitable

Error: Aborted (core dumped)

1 #include <stdio.h> 2 #include <stdlib.h> 3 int main(void) { 4 char *str; 5 6 if( (str = mal ... Aborted (core dumped)). The error occurs in line 15, if you remove 15: then everything is normal. What could be the problem?

The area of a regular hexagon

On e-olimp, there is a problem in which you need to find the area of a regular hexagon on a given side: Area of the hexagon M ... amp;L); S = ((3 * sqrt(3)) / 2) * ((2 * L) / sqrt(sqrt(3))) * ((2 * L) / sqrt(sqrt(3))); printf("%lld\n", S); return 0; }

How can I output the argument of a function written in GNU Assembler (AT&T syntax) in C?

There is a task-to write a program from two modules: one in C, the second in assembly language. All sources unanimously state ... n KUbuntu OS. Question: where does this first argument hide, and how do I finally get it out and return it to the C module?

Find all perfect numbers less than N

Help. Faced with a very strange problem of its kind. The lab was given a task. Theoretically, I wrote everything correctly, b ... ;i++) { for (n=1;n<i;n++) { if (i%n==0) sum=sum+n; } if (i==sum) printf("совершенное %d\n", i); } } The program is in C.

Solving a problem using a for loop

There is such a task: Starting training, the athlete ran 10 km on the first day. Each day, he increased the norm by 10% of ... omething like this: s=10 k=10 for(k=s*0,1+k) s+=s*0,1 And how do I get the result here? Need to set a variable, or what?

What does setenv () do?

There is such a code: void initializeSuplies(int paper) { char paperBuffer[10]; snprintf(paperBuffer, 10, "%d", paper); seten ... on unix? It is possible on points: The initializeSuplies () function is called The paperBuffer{[9] array is created]} ? ?

Using STARTUPINFO to create a new process

Good time of day! There is such a code: STARTUPINFO si; PROCESS_INFORMATION pi; RtlZeroMemory(&si,sizeof(si)) ... not used when creating the process. I.e. neither positioning nor capshn installation occurred. Actually, that's the problem.

Writing data to a file in a single line.

Hi) there was a problem in that sho when fills in the data in the file everything is written in one line bm2?????????2020??? ... zeof (b),1,avto); printf ("\nfinish? y/n"); printf ("\n"); ch=getch (); } while (ch!='y'); fclose (avto); }

How to find the time difference in C?

Formed the time t1,t2 by mktime. Now we need to find the difference. For some reason, my watch is 6 hours longer. What to do?

C++ implementation of the List class, insert method

Implementing the List class, there are problems with the Insert method. This method works the same way as in the list library ... ); } curindex++; cur = cur->GetNext(); } } How can this method be implemented more correctly?

Exponentiation modulo. Large numbers in C

Hello! I need to calculate: 2147483647^2147483647%2147483648; 2147483647=2^(31)-1; Please tell me how to implement this in c?

Why does a binary file display letters instead of numbers?

I need to write the array elements (integers) to one binary file, then read these elements from there, change the array and w ... t; n; j++) { printf("%4.1f ", b[j]); } fclose(f); printf("\n"); system("pause"); return 0; }