PO
When I run the executable file
PO
I give the argument
PO
But nothings happend
Asdew
Please, give me (and the whole group) complete sentences.
Asdew
What does strcmp return and how do you call it?
PO
I'm writing a program which takes an argument in command line and it compares argument given by command line with a string or world, which is store inside an array
PO
(Strcmp(x1 , x2) == 0), strcmp compare x1 and x2 and return True
PO
I give Pouria like argument
PO
Pouria like x2 and argv[] like x1
PO
So if(strcmp(argv[] , x2) ==0) is true, program should print Pouria
PO
But nothing happen
PO
Any help?!
intVecT[0]()
Read about arrays and program arguments
Alex
Any help?!
please provide source
PO
please provide source
What do you mean?! I post my code?!
Alex
What do you mean?! I post my code?!
code which can be compiled and run
intVecT[0]()
If u're passing argv to strcmp, u're always comparing ur words with argv[0], which is always exe's own path (cmd it was started with)
intVecT[0]()
Read about arrays and program args
Asensio
Hi everyone
PO
PO
#include <stdio.h> #include <string.h> #include <stdlib.h> int main( int argc, char *argv[] ){ if( argc == 4) { if(strcmp(argv[1], "Pouria") == 0){ printf("hello Pouria\n"); printf("%s", argv[1]); }else{ printf("False \n"); } } }
intVecT[0]()
if( argc == 4) {
Alex
if( argc == 4) { this means you should provide three arguments
Alex
./a.out Pouria 32 43
Alex
it works
PO
Yes
PO
I understood
PO
What was wrong
PO
I gave it less than 4 argument
Yogesh-598
Hi guys
Mandelbröt
Can anyone help me to build a convex hull polygon from n points (points that lies in the edges of the polygon must be included , collinear points )
Mandelbröt
Mandelbröt
Can anyone help me to build a convex hull polygon from n points (points that lies in the edges of the polygon must be included , collinear points )
https://stackoverflow.com/questions/62746553/convexhull-polygon-including-the-points-on-the-edges-of-the-polygon?noredirect=1#comment110960961_62746553
Anonymous
/report
Anonymous
Can anyone plz help me in this program .. no compilation error but program is not working... It doesn't give any result .. #cprogramming
Mandelbröt
That means i have to sort on the basis of polar angle (counterclock wise ) as it is , but in the case of collinear points when the angle will be same i have to store only the lowest y coordinate point or all points ?
Mandelbröt
Is there anything to change on the main hull code too for this , or i have to only update the comparator function used in sort function (sorting the points on the basis of counterclockwise polar anglea )
Mandelbröt
Is there any method to sort points on the basis of angles using cross product ? Or i have to find the degree using tan theta !?
Mandelbröt
Oooh okay i should try this
Mandelbröt
In this i have to sort A B and C according to the x axis and y axis for other points !?
Mandelbröt
For non collinear points i have to find the exact degrees or this comparator function with sort work (gfg code for graham scan ) https://www.geeksforgeeks.org/convex-hull-set-2-graham-scan/
Mandelbröt
How to deal with the collinear points like B O and D or A M and E !?
Mandelbröt
Okay thanq so much 🙏 I ll ask again if things don't go according to plan 😅
Mandelbröt
Okay thnx and sorry 😅
Aman
Node<int>* deleteMid(Node<int> *head) { Node *n=head; int c=0; while(n!=NULL){ c=c+1; n=n->next; } int d=c/2; Node *curr=head; count=c; while(curr!=NULL){ count=count-1; curr=curr->next; } temp=curr.next; curr.next=temp; return head;
Aman
Compilation Failed In file included from runner.cpp:22:0: solution.h: In function 'Node* deleteMid(Node*)': solution.h:26:10: error: missing template arguments before '*' token Node *n=head; ^ solution.h:26:11: error: 'n' was not declared in this scope Node *n=head; ^ solution.h:33:10: error: missing template arguments before '*' token Node *curr=head; ^ solution.h:33:11: error: 'curr' was not declared in this scope Node *curr=head;
Aman
pls anyone help me with that
Aman
Node<int>* deleteMid(Node<int> *head) { Node<int> *n=head; int temp; int c=0; while(n!=NULL){ c=c+1; n=n->next; } int d=c/2; Node<int> *curr=head; int count=c; while(curr!=NULL){ count=count-1; curr=curr->next; } temp=curr->next; curr->next=temp; return head;
Aman
Compilation Failed In file included from runner.cpp:22:0: solution.h: In function 'Node* deleteMid(Node*)': solution.h:40:16: error: invalid conversion from 'Node*' to 'int' [-fpermissive] temp=curr->next; ^ solution.h:41:15: error: invalid conversion from 'int' to 'Node*' [-fpermissive] curr->next=temp; ^4
Aman
@lightness_races_in_orbit now tell me pls where i am getting wrong?
Anonymous
Look at the types of variables in the errors
Anonymous
+1
Anonymous
He/she is not blind just confused
Anonymous
You comment like you are very best in this field Don't you remember you were also like that once
Anonymous
Instead of helping you comment
Anonymous
Tell me were you always this good in programming
Aman
@lightness_races_in_orbit @A actually i recently shifted from python to c++ so i am having some problems in concepts like templates and standard tempelate library (it doesn't means that I did not studied them) otherwise my basics are clear.
Aman
@lightness_races_in_orbit and btw i was just asking for help if u don't want to help me you can refuse also
Anonymous
Yes thats the point some can study and some can't they have to look for different resources for answers You studied on your own that's good but everyone is not same
Aman
@lightness_races_in_orbit You had replied earlier that's why i asked
Anonymous
Oh they tag you because they think you or anybody else can help
Anonymous
But you are full of ego miss
Anonymous
You should put your phone on mute or something
Aman
@lightness_races_in_orbit and i am having nothing anything personal grudges from you
Aman
A @lightness_races_in_orbit now we should move on as fight will waste our time only
Anonymous
Oh you should keep it to yourself miss it will help you
Anonymous
Because you worth it
Poonam
Can anyone send notes or PDF of function and loops
Josh
#include <stdio.h> int main (void) { int numbers[10] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int i, j; for ( j = 0; j < 10; ++j ) for ( i = 0; i < j; ++i ) numbers[j] += numbers[i]; for ( j = 0; j < 10; ++j ) printf ("%i ", numbers[j]); printf ("\n"); return 0; } Pls I need someone to explain the above code for me..The outcome is 1,2,4,8,16,32,64,128,256 and 512....I need someone to explain the two for loops and how they were able to come up with the results.
Josh
Pls you can DM me the explanation..thanks alots
Anoop
hey all!, I'm trying to write a small program to unpack a tar file, the tar file isn't compressed with gz or anything its a simple .tar file. I'm using tar_extract_all() from "libtar.h" to extract all files, but it fails showing "tar_extract_all(): invalid argument". However a single file is extracted from the archive and empty directory structure is created. https://hastebin.com/ehupusojig.cpp
Bunyamin
hi! I went to receiving data with c++ than excel help me please
Indolent
Can a function be used inside a function?
Indolent
In which it was created in
Indolent
Like can doSomething() be used inside doSomething()
Indolent
Oh my duck
Indolent
I was brainstorming for half an hour for this