## c ++ – Convert the int char

I am programming in Arduino (C ++) and need to convert a char variable to int.

My goal is: I use a char-type array, and whenever I'm in a certain position in the array, it executes a command.

Example:

Char Diaweek[7] = {"sun", "sec", "ter", "qua", "who", "sex", "sab"};

if (day-week == 2) {…}

or

if (daySum == "sec") {…}

Thank you for any help!

## How to calculate the integral \$ int _ {- 10} ^ {10} frac {3 ^ x} {3 ^ { lfloor x rfloor}} dx \$?

I have to calculate this integral:
$$int _ {- 10} ^ {10} frac {3 ^ x} {3 ^ { lfloor x rfloor}} dx$$

I know this function to know. $$3 ^ {x- lfloor x rfloor}$$ is periodic with period $$T = 1$$ so I've rewritten the integral as $$20 int_ {0} ^ {1} frac {3 ^ x} {3 ^ { lfloor x rfloor}} dx$$

But the problem is that I can not understand how to calculate the final integral.

Any help is appreciated.

## python – Convert pyodbc.cursor to int or other formats

I have this code

``````Def Read (conn):
Lines = conn.execute ("select count (*) from Purchases")
print (lines)

Read (conn)
``````

and I get this result

which in SQL Server represents the number of rows that I have.
How can I convert it to int? and in general, how to convert this type of results into the formats of your choice?

## difference in efficiency between java int and byte

There is really a difference between an int data type and a byte type, I know it's easier to "understand" in terms of reading and writing code, but the Byte theoretically occupies less storage space, I say "in theory" because somebody once said that the Java virtual machine stored the information in spaces of 4 bytes and that the management of a byte was then identical to the management of an integer, since the remaining 3 bytes were wasted. and in terms of running time, is there really a difference?
As for the code structure that is such a good practice to do in a program, I know that doing it to save 6 or 9 bytes does not make sense, and in that case the best thing to do is to use an int since the backup is really insignificant and it is worthwhile to "sacrifice the readability of the code", but if you manage about 20,000 data, is there a noticeable difference or is it better to continue using int for convenience, which would constitute a considerable amount of data, so that it is really worth using byte and not int?

## c – The most efficient way to implement a power function based on an integer pow (int, int)

In addition to the Elias response, which causes an undefined behavior when it is implemented with signed integers and incorrect values ​​for a high input when it is implemented with unsigned integers,

Here is a modified version of Exponentiation by Squaring that also works with signed integer types and does not give incorrect values:

``````#understand

#define SQRT_INT64_MAX (INT64_C (0xB504F333))

int64_t alx_pow_s64 (int64_t base, uint8_t exp)
{
int_fast64_t base_;
int_fast64_t result;

base_ = base;

if (base_ == 1)
returns 1;
if (! exp)
returns 1;
if (! base_)
returns 0;

result = 1;
if (exp & 1)
result * = base_;
exp >> = 1;
while (exp) {
if (base_> SQRT_INT64_MAX)
returns 0;
base_ * = base_;
if (exp & 1)
result * = base_;
exp >> = 1;
}

return the result;
}
``````

Considerations for this function:

``````(1 ** N) == 1
(N ** 0) == 1
(0 ** 0) == 1
(0 ** N) == 0
``````

If an overflow or packaging is to take place, `returns 0;`

I used `int64_t`but any width (signed or unsigned) can be used with little modification. However, if you need to use an integer type of non-fixed width, you will need to modify `SQRT_INT64_MAX` by `(int) sqrt (INT_MAX)` (in the case of use `int`) or something similar, which should be optimized, but it is uglier, and not a constant expression C. Also the result of `sqrt ()` has a `int` is not very good because of the floating point precision in the case of a perfect square, but as I do not know any implementation where `INT_MAX` -or the maximum of any type- is a perfect square, you can live with that.

## How to evaluate \$ int_ {0} ^ { infty} ln ^ 2 (x) ln (1 + x) ln ^ 2 left (1 + frac {1} {x} right) frac { dx} {x} \$

$$I = int_ {0} ^ { infty} ln ^ 2 (x) ln (1 + x) ln ^ 2 left (1 + frac {1} {x} right) frac { mathrm dx} {x}$$

$$ln (1 + x) = x- frac {x ^ 2} {2} + frac {x ^ 3} {3} – cdots$$

$$int_ {0} ^ { infty} left (1- frac {x} {2} + frac {x ^ 2} {3} + cdots right) left[ln(x)lnleft(1+frac{1}{x}right)right]^ 2 mathrm dx$$

This integral takes the form of $$J = int_ {0} ^ { infty} x ^ n left[ln(x)lnleft(1+frac{1}{x}right)right]^ 2 mathrm dx, n ge0$$

$$u = left[ln(x)lnleft(1+frac{1}{x}right)right]^ 2$$

$$u ^ {# 1} = frac {2 ln (x) ln (1 + 1 / x) left[(1+x)ln(1+1/x)-ln(x)right]} {x (1 + x)}$$

$$v = frac {x ^ {n + 1}} {n + 1}$$

$$J = frac {x ^ {n + 1}} {n + 1} left[ln(x)lnleft(1+frac{1}{x}right)right]^ 2- frac {2} {n + 1} int_ {0} ^ { infty} x ^ {n + 1} cdot frac { ln (x) ln (1 + 1 / x) left[(1+x)ln(1+1/x)-ln(x)right]} {x (1 + x)} mathrm dx$$

Wow … it gets too hard, I'm totally lost, no help.

## inequality – Given two increasing continuous functions \$ f, g \$ prove that \$ (ba) int ^ b_a f (x) g (x) dx> int ^ b_a f (x) dx int ^ b_a g (x) \$ dx

This is the integral inequality of Chebyshev. The following proof is
http://imar.ro/journals/Mathematical_Reports/Pdfs/2010/2/Niculescu.pdf
(Theorem 3):

If \$ f \$ and \$ g \$ both increase (or decrease both) then
\$\$ tag {*}
0 le bigl (f (x) – f (y) bigr) cdot bigl (g (x) – g (y) bigr)
\$\$
for all \$ x, y in [a, b]\$. It follows that
\$\$
0 the int_a ^ b int_a ^ b bigl (f (x) – f (y) bigr) cdot bigl (g (x) – g (y) bigr) , dx dy \
= 2 (ba) int_a ^ bf (x) g (x) , dx – 2 left ( int_a ^ bf (x) , dx right) left ( int_a ^ bg (x) , dx right) ,.
\$\$

If \$ f \$ goes up and \$ g \$ goes down (or vice versa), then the
the inverse inequality is valid.

Yes equality then holds the equals worth in \$ (*) \$ for all \$ x, y
in [a, b]\$ (since \$ f \$ and \$ g \$ are supposed to be continuous).
In particular
\$\$
0 = bigl (f (a) – f (b) bigr) cdot bigl (g (a) – g (b) bigr)
\$\$
which means that (at least one of) \$ f \$ or \$ g \$ is constant.

## carbonize[] and int[] ambiguity in c ++

``````char str1[] = "amruth";
cost << str1 < Amruth
cost << & str1 < address

int arr[] = {1,2,3};
cost << arr < Address
cost <<&arr;         //output -> Same address as above
``````

Why is this behavior different for char?[] and int[] ?

## eclipse – How to cut a string and convert to int in Java?

How can I cut the monthAndYear String, convert and assign the variables
respective? At the moment of conversion, you get an error.

``````System.out.print ("Enter the month and year to calculate the income (MM / YYYY):");
String monthAndYear = sc.nextLine ();

int month = Integer.parseInt (monthAndYear.substring (0, 1));
int year = Integer.parseInt (monthAndYear.substring (3));
``````

## integration – Calculation of the double integral \$ int_ {0} ^ {t} { int _ {- infty} ^ { infty} e ^ {| x- xi |} cdot sin (t- tau) cdot varphi ( xi, tau) d xi d tau} \$

I have a question as follows:

$$u (x, t) = frac {1} {2} int_ {0} ^ {t} { int _ {- infty} ^ { infty} {{e} ^ {- | x- xi |}} cdot sin (t- tau) cdot varphi ( xi, tau) d xi d tau}}$$

or $$0 < tau and $$varphi ( xi, tau)$$ is any function satisfactory $$varphi ( xi, tau) to 0$$ as $$xi to pm infty$$.

I wish to find his analytical solution.

Could you please help me for that?

Thank you so much !! ^^