Emir
Ya please🙏🙏
getchar() function is same time using for clearing de stdin file https://stackoverflow.com/questions/36715002/how-to-clear-stdin-before-getting-new-input?rq=1 https://stackoverflow.com/questions/52619841/how-can-i-clear-stdin-in-a-c-progam/52619971 U can read it both
Emir
void clear (void) { while ( getchar() != '\n' ); } Function is using clear buffer, thanks to you, i’ve learnt Tushar
Emir
https://paste.ubuntu.com/p/7KHwVXBFjn/ U can read this code, first you read with //getchar(); after that u can remove commentline getchar(); And finally u can get it how it getchar function works
Nool
If you are using c++, then cin works well.
Anonymous
Im really want to be proggramer but ı see some programmers use mac whats things i cannot i find it on windows when i use mac
Emir
Im really want to be proggramer but ı see some programmers use mac whats things i cannot i find it on windows when i use mac
Good question, im using mac too. I think the advantages of using mac are these: battery time, portability, operating system, trackpad Mac os x more comfortable than Windows for a developer(i think)
Anonymous
Yess but some of developers says real developers dont use mac
Nool
No, not at all. If you are a good programmer, you know Unix.
Anonymous
We are thinking same pattern
Nool
That is enough.
Anonymous
Im worried about some software which i will not use in mac
Nool
Sometimes you have to pay for softwares in mac.
Nool
I think which is unnecessary.
Nool
That is I know, I said sometimes.
Francisco
Do you know people here doesn't have to understand indian?
Francisco
I don't care, I don't understand neither of those, but I do understand English
Francisco
Which is the main language in this group
Nool
Please don't make any assumptions, before you say something think about others. It's not your home.
Nool
Here, anyone can join group so you are nobody to comment on others language.
Francisco
Oh boy it is written indeed
Anonymous
Hello, I'm Brazilian and I'm starting in C ++. I'm trying to create an array that already contains a certain value for all positions. for example, an array of 500 positions where all elements are integer 0
Anonymous
Please, only English 🙂
Nool
Use memset
Francisco
Go to the pinned comment and read all the way through: "Only English language is allowed, if you speak shitty English or don't understand anything in English YOU WILL BE BANNED"
Anonymous
I don't believe that the menset works for me.
Renan
Yess but some of developers says real developers dont use mac
Real developers develop things that work. The rest is myth. The OS or compiler you use does not matter.
Mailto_Harry_Fameex_Listing
Please I need link for c/c++ complete video from begging to advance
Mailto_Harry_Fameex_Listing
How much do u want
Renan
How much do u want
Nothing. I know about written content about C/C++. Are you interested? 🤔
Mailto_Harry_Fameex_Listing
Yes I do
Dima
lol
Anonymous
for (r = 0;r<=9;r++) { //USE inner loop cout << "Enter details of Competitor " << r+1 << " "; for(c=0;c<=1;c++) { cin >> sdata[r][c]; } cout << endl; }
Anonymous
Please can anyone explain why pressing spacebar allows the nested loop to proceed with the second cycle and not rather pressing enter.
Anonymous
Please I didn't get that
Anonymous
Well, not that there is a problem with the loop. That is only a fragment of an assignment which I am analysing and the instruction said that I should press spacebar after the first nested loop cycle and to my amazement, entering the next value assign it to the next array index but I rather expected an enter key to do the job.
Anonymous
So I am hoping that anyone can explain the reason behind what happened.
Erdem
Her name is alita @alkalemir .
Erdem
Welcome..
@.!
Can you tell me what is the mistake in this code?
Erdem
This the code but she is delete.
@.!
#include <iostream> #include <cmath> using namespace std; int main () { int i,j; for(int i=5;i>=1;i--) { for(int j=1;j<=4;j++) { if( i>=j){ cout<<""; } for (int j=1;j<=5;j++) { if ( i<=j){ cout<<j; } for (int j=4;j>=1;j--){ if ( i<=j){ cout<<j; } } } } cout <<endl; } return 0; }
Emir
paste.ubuntu.com
Erdem
What is problem?
@.!
I want to draw a triangle of numbers
@.!
Emir
wait a minute
@.!
Okay
Emir
Okay
https://paste.ubuntu.com/p/Y4FSkwsFBP/ here
Emir
https://paste.ubuntu.com/p/Y4FSkwsFBP/ here
Emir-MacBook-Air:Desktop emiralkal$ ./emir 5 4 5 4 3 4 5 4 3 2 3 4 5 4 3 2 1 2 3 4 5 4 3 2 1 Emir-MacBook-Air:Desktop emiralkal$ The output is like that
Emir
Really thanks a lot for help
u are welcome, i wrote in c u can change if u want printf to cout
Emir
is malloc and new exactly same? I have a class that the name is Entity ———————————— Entity * e = malloc(sizeof(Entity)); free(e); ————————————- Entity * e = new Entity(); delete[] e; What is the difference between them?
Sinan
Just "same" ? Can you open the subject a little more ?
Anonymous
https://stackoverflow.com/a/240308
Hidd3N
is malloc and new exactly same? I have a class that the name is Entity ———————————— Entity * e = malloc(sizeof(Entity)); free(e); ————————————- Entity * e = new Entity(); delete[] e; What is the difference between them?
In the first example, the malloc will not call ctor, it will just allocate the memory of size Entity. Free will just deallocate without calling dtor. However in second example the new will call ctor and delete will call dtor. The problem with ur code is "delete[]" is used for array. Since youre not allocating array at the time of new, so just "delete e;" is fine.
Anonymous
i am learning C language but I am unable to understand pointer deeply. Can you guys suggest any book or lecture for C language learning
Sinan
i am learning C language but I am unable to understand pointer deeply. Can you guys suggest any book or lecture for C language learning
You can check here and related articles https://www.geeksforgeeks.org/pointers-in-c-and-c-set-1-introduction-arithmetic-and-array/
Anonymous
Okay got it. So if I had'nt used getchar in this program ,compiler would'nt executed the gets(c) statement . Can you explain why?
the last getchar() keeps your program waiting for an input after the computation is done. otherwise the program window would close after its work was done. this should be avoided because there are IDE project settings that can already stop the window from closing. further, these programs should be launched from a terminal instead of launched by double clicking.
Anonymous
What are constructers and objects in C++? Can someone please explain?
Anonymous
anyone can recommend some materials of fastcgi? Some kind of detailed enough to implement it
Andrea
I would have a question about C's realloc () function I created an insertion function that fills an array based on double written in a file, so I don't immediately know how much memory to allocate, so I used an index and this increased in a while and continued to make a realloc () and in the meantime entered the new numbers in the file If I print the vector in the function, however, it is fine .. while in the main, it prints all 0 .. does anyone know why? Thanks
Mar!o
Pls share your Code
Mar!o
realloc can be tricky for beginners