Mr
alessandro
What?
Nur Mohammad
am new member in this group, i study EEE department. and i want to learn C program. How do i learn C program?
Deepak Chaurasia
Deepak Chaurasia
It happens due to maths practice 😂
klimi
klimi
Eugene
浩
Hello, I need a blas ?gemm(a[i,k] = sum_j b[i,j] c[j,k]) like function: a[i,k,x] = sum_j b[i,j,x] c[j,k,x] , is there any function can do it?
浩
Is there any library implement such a function?
alessandro
Hello, I need a blas ?gemm(a[i,k] = sum_j b[i,j] c[j,k]) like function: a[i,k,x] = sum_j b[i,j,x] c[j,k,x] , is there any function can do it?
??
alessandro
I know function, called accumulate in c++ if you want sum numbers inside array
Secure human
I searched on the Net about opencv (for c), but I did not understand if i have tô install in my PC or if i have tô put in C with the terminal in some way
Thadeu
I have two kinds of data:
const char *
char *
I'm writting a function that will receive one of them alternately and return
char *
Inside of function I will handle different operations on a copy of received string.
How should be signature?
char *x ( char *str );
or
char *x ( void *str );
?
alessandro
alessandro
It's not possible put void as type of argument
Thadeu
yes... the compiler warns on using const char as char... so passing as void would receive anything and would cast only inside the function as
(char *)
Thadeu
Thadeu
(void *)
is basically any kind of pointer without type limitation
Pavel
Pavel
Thadeu
Yes as const expect to not modify the pointer value... but I will use it to inner copy (to avoid the trouble you refer)
Pavel
Pavel
So you need only one version
Pavel
If I understand you correctly
Thadeu
yes...
You understood!
It is the kind of thing in C we have no examples, just follow intuition.. but there are some forks, so is always good have a different opinion.
Thank you much!!!
Pavel
Ludovic 'Archivist'
They asked why I put it in the lesson if it is wrong
Ludovic 'Archivist'
Well, "so that [they] can look at whoever uses it with eyes of anger and confusion" was my answer
klimi
awesome
klimi
but in some cases it may make a little bit of sense
Ludovic 'Archivist'
Otherwise, your const value may never be truly updated
Faramarz
Do you know which option is correct for this question? I chose D, but I am not sure which option is right and why👇
You are using the assignment operator to assign a value to variable a and the expression on the right side is not evaluating to the value you expect. What is a possible cause?
A) An equality was evaluated after a bitwise OR operation where the equality was to the left of the bitwise OR.
B) The assignment operator appeared to the left of an equality operator.
C) Assignment operators have right to left associativity and you thought it was left to right.
D) Any of these could explain the issue.
Asker
Hello everyone
Asker
#include<iostream>
#include<cmath>
using namespace std;
int main(){ int a,b,n; cin>>a>>b; n=(a+b)/2;
if ( a<pow(10,9)) && b<pow(10,9)) cout<<n; }
Asker
I cant find the problem in this code
Anonymous
Asker
Ok İ am trying it now
Asker
Anonymous
But how?
Write down your problem firstly in google search
~
Hello friends. I am a computer student and I am interested in hacking. If you can guide me where and what to start for the beginning. I want to start from zero. Please share your experiences with me. Thank you.
Mohamed Ahmed
Wrong answer test 2
Mohamed Ahmed
int main ()
{
int t ;
cin >>t;
while (t--)
{
ll a , b ;
int c =-1 ,sum = 0;
cin >> a >>b;
for (int i = a; i<=b;i++)
{
int lucky = 0 , x = i;
while(x)
{
if (x%10!=4 && x%10 !=7)
lucky ++;
x=x/10;
}
if (lucky == 0)
{
sum+=i;
c++;
}
}
cout <<sum<<endl;
}
return 0;
}
Mohamed Ahmed
Given two numbers A , B.
Print the summation of digits of all lucky numbers between A , B inclusive.
Input
First line contains a number T (1≤T≤100) number of test cases.
Next T lines contain two numbers A , B (1≤A,B≤1018).
It's guaranteed that |A−B| does not exceed 10 ^ 4 .
Output
For each test case , print the summation of digits of all lucky numbers between A , B
Mohamed Ahmed
Mohamed Ahmed
The lucky number is any positive number that its decimal representation contains only 4 and 7.
For example: numbers 4, 7, 47 and 744 are lucky and numbers 5, 17 and 174 are not.
Arnold
Arnold
good luck sir
Arnold
you can easily find the next lucky number from a particular previous lucky number
Arnold
the only tricky part (and very fun part) is quickly finding the first lucky number after A but it's similar to the previous case
Arnold
you can look at your lucky numbers as binary numbers, but instead of 1s and 0s you have 4s and 7s. Maybe this representation will help you to iterate through them. 0, 1, 10, 11, 100...
Dima
gtfo trader
Manuel
Manuel
Manuel
Or you go through all the sizes, take all the combinations of 4 and 7 at every position and adds
Billionaire
Hello
Billionaire
#include<stdio.h>
#include<string.h>
void reverse(char str[])
{
int len=0;
int i;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
len++;
}
char rev[200];
for(i=len-1;i>=0;i--)
{
rev[len-i-1]=str[i];
}
printf("\nReverse is : %s",rev);
}
void characters(char str[])
{
int len=0;
int i;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
if(str[i] !=' ')
len++;
}
printf("\n No of characters are :%d",len);
}
void copy(char str[])
{
int len=0;
int i;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
len++;
}
char rev[200];
for ( i = 0; str[i]!='\0'; i++)
{
rev[i]=str[i];
}
printf("\n New String is :%s",rev);
}
void vowels(char str[])
{
int i,vow=0;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
if(str[i]=='a' str[i]=='e' str[i]=='i' str[i]=='o' str[i]=='u' str[i]=='A' str[i]=='E' str[i]=='I' str[i]=='O' str[i]=='U' )
vow++;
}
printf("\n No of vowels in the string is : %d",vow);
}
void consonant(char str[])
{
int i,con=0,len=0;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
len++;
}
for ( i = 0; str[i]!='\0'; i++)
{
if(str[i]== 'a' str[i]=='e' str[i]=='i' str[i]=='o' str[i]=='u' str[i]=='A' str[i]=='E' str[i]=='I' str[i]=='O' str[i]=='U' || str[i]==' ' )
con++;
}
printf("\n No of consonants in the string is : %d",len-con);
}
void aplhabet(char str[]) {
int count=0,i;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
count++;
}
for (int i = 0; i < count; i++)
{
for (int j = i + 1; j < count; j++)
{
if (str[i]+1 > str[j]+1 )
{
char temp;
temp= str[i];
str[i]= str[j];
str[j]= temp;
}
}
}
printf("\n %s",str);
}
int main()
{
int ch;
char str[100];
char sel='y';
printf("\n1.Reverse the string\n");
printf("\n2.Count the no. of characters in a string\n");
printf("\n3.Copy one string from another string\n");
printf("\n4.Count no of vowels\n");
printf("\n5.Count no of Consonants and no of punctuations\n");
printf("\n6.Arrange in Alphabetical ordeer\n");
printf("\n enter your choice :: ");
scanf("%d",&ch);
switch (ch)
{
case 1: reverse(str);
break;
case 6: characters(str);
break;
case 2: copy(str);
break;
case 3: vowels(str);
break;
case 4: consonant(str);
break;
case 5: aplhabet(str);
break;
default: printf("\n Wrong choice entered");
}
return 0;
}
Billionaire
#include<stdio.h>
#include<string.h>
void reverse(char str[])
{
int len=0;
int i;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
len++;
}
char rev[200];
for(i=len-1;i>=0;i--)
{
rev[len-i-1]=str[i];
}
printf("\nReverse is : %s",rev);
}
void characters(char str[])
{
int len=0;
int i;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
if(str[i] !=' ')
len++;
}
printf("\n No of characters are :%d",len);
}
void copy(char str[])
{
int len=0;
int i;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
len++;
}
char rev[200];
for ( i = 0; str[i]!='\0'; i++)
{
rev[i]=str[i];
}
printf("\n New String is :%s",rev);
}
void vowels(char str[])
{
int i,vow=0;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
if(str[i]=='a' str[i]=='e' str[i]=='i' str[i]=='o' str[i]=='u' str[i]=='A' str[i]=='E' str[i]=='I' str[i]=='O' str[i]=='U' )
vow++;
}
printf("\n No of vowels in the string is : %d",vow);
}
void consonant(char str[])
{
int i,con=0,len=0;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
len++;
}
for ( i = 0; str[i]!='\0'; i++)
{
if(str[i]== 'a' str[i]=='e' str[i]=='i' str[i]=='o' str[i]=='u' str[i]=='A' str[i]=='E' str[i]=='I' str[i]=='O' str[i]=='U' || str[i]==' ' )
con++;
}
printf("\n No of consonants in the string is : %d",len-con);
}
void aplhabet(char str[]) {
int count=0,i;
printf("\nEnter the string:: ");
gets(str);
for ( i = 0; str[i]!='\0'; i++)
{
count++;
}
for (int i = 0; i < count; i++)
{
for (int j = i + 1; j < count; j++)
{
if (str[i]+1 > str[j]+1 )
{
char temp;
temp= str[i];
str[i]= str[j];
str[j]= temp;
}
}
}
printf("\n %s",str);
}
int main()
{
int ch;
char str[100];
char sel='y';
printf("\n1.Reverse the string\n");
printf("\n2.Count the no. of characters in a string\n");
printf("\n3.Copy one string from another string\n");
printf("\n4.Count no of vowels\n");
printf("\n5.Count no of Consonants and no of punctuations\n");
printf("\n6.Arrange in Alphabetical ordeer\n");
printf("\n enter your choice :: ");
scanf("%d",&ch);
switch (ch)
{
case 1: reverse(str);
break;
case 6: characters(str);
break;
case 2: copy(str);
break;
case 3: vowels(str);
break;
case 4: consonant(str);
break;
case 5: aplhabet(str);
break;
default: printf("\n Wrong choice entered");
}
return 0;
}
why it is not taking input?
Billionaire
NebAbdi
Guys can you help me complete the following function please🙏
Def XOR (a,b)
# both a and b are booleans
# if both are equal return true
# else return false
NebAbdi
Anyone?🥲
西琳
I can't
DaviChan
Doreece
Hi. Can anyone explain how should I solve Time Limit Exceeded Error ?
klimi
klimi
klimi
I don't think they were asking for debugger. (I think it was for IDE)
klimi
Doreece
Doreece