Void
It does not output results
During runtime
DaviChan
Never heard before 🤔
Its pretty cool. Light weight and portable, so you can have it on a usb stick. I think its only for windows though and i havent used it in like 10years
DaviChan
Looks horrible from a ux standpoint though 😂 but thats nothing i personally care about much
DaviChan
Nvm. It looks very good now
ببب ب
Returning raw owning pointers is bad, but do you think it's OK to do so when the function's only purpose is to be consumed by a function take takes ownership? So: 1) Function create returns owning raw pointer 2) Function set accepts an owning raw pointer and assumes ownership. I can't modify this function. if I were to make create return unique_ptr, it would look like: std::unique_ptr<Foo> ptr = create(...); model.set(ptr.release()); (or put it in one line, doesn't matter) However I feel like this is just fanfare to keep with ownership safety and distracts from the actual purpose of the function - it's called in this one place and this one place only.
DaviChan
But as said: preference. That is only my take on it. There are people with a more radical view in both directions for sure
Ольга
https://onlinegdb.com/ZRFUkmwN0 Good evening, sorry to bother you. I hope someone will help, my teacher in college said that the functions are parts of the object, so the object itself does not need to be passed to them. But I don't understand how it should work then (if it's not difficult for someone, at least explain it to me on the example of my input function). Any help or advice
/
help
/
i have a question
/
when in assembly you execute the int instruction is it like when you call a function
/
i mean what happens when it is executed
모하마드
Input two numbers (k and c) and calculate the value of y for x = 0.1, 1, 5 where y = kx + c
Specified the output and input sample so we can understand the programming flow 🙏🏻
모하마드
Input two numbers (k and c) and calculate the value of y for x = 0.1, 1, 5 where y = kx + c
Maybe this is what you looking for: before i will not using input instead i will give you example using it with defined var
모하마드
Maybe this is what you looking for: before i will not using input instead i will give you example using it with defined var
#include<stdio.h> int main() { float k = 1;float c = 2;float y= 0; float x[3] = {0.1,1,5}; for (int iter = 0;iter < 3;iter++) { k *= x[iter]; } y = k + c; printf("%.2f",y); }
모하마드
i mean what happens when it is executed
There will be "call" assembly instruction and then it will call the pointed function address and you can see what happen inside that called function if you jump into the address which store the function execution flow. If you have experience with disassembler like x32/x64dbg, ollydbg , IDA and much more you will know what does that mean. Of course inside the function there will is CPU register will be pushed and the end point you will be see down below there is a "ret" assembly instruction that indicating it is the end of function block inside assembly
Emmanuel
#include<stdio.h> int main() { float k = 1;float c = 2;float y= 0; float x[3] = {0.1,1,5}; for (int iter = 0;iter < 3;iter++) { k *= x[iter]; } y = k + c; printf("%.2f",y); }
Well .. this is a good trial but I don't think it solves the question. The question requires computing the different values of y in given k and c as constants in the equation of a straight line. You can either output the values of y computed on each iteration or store them in a separate array then output them using another loop.. I hope you figured out which is computationally intensive aiidy...
Emmanuel
#include<stdio.h> int main() { float k = 1;float c = 2;float y= 0; float x[3] = {0.1,1,5}; for (int iter = 0;iter < 3;iter++) { k *= x[iter]; } y = k + c; printf("%.2f",y); }
Just a little correction.. #include<stdio.h> int main() { float k = 1;float c = 2;float y= 0; float x[3] = {0.1,1,5}; for (int iter = 0;iter < 3;iter++) { k *= x[iter]; y = k + c; printf("%.2f\n",y); K=1; } return 0; } Notice the scope..
Pavel
Try to use || or && in if condition
I bet they used || but telegram also uses it for spoiler tag :)
Pavel
Sure, but why sending this to me? :)
Anonymous
Sure, but why sending this to me? :)
To let you and others know that telegram doesn't interpret || within code snippets as a spoiler tag. Yours was the only message I could reply to which had the context.
Anonymous
when in assembly you execute the int instruction is it like when you call a function
Is not like calling a function, you are generating a software interrupt which is handled according to a procedure specified by the operating system to the CPU's interrupt descriptor table
Anonymous
In real mode IDT is analogous to IVT (interrupt vector table) and BIOS specifies interrupt handlers
Pavan
How to print circle using star in c++
Mahmoud
#include <bits/stdc++.h> using namespace void printPattern(int radius)   float dist;   for (int i = 0; i <= 2 * radius; i++) {           for (int j = 0; j <= 2 * radius; j++) {       dist = sqrt((i - radius) * (i - radius) +                   (j - radius) * (j - radius));                if (dist > radius - 0.5 && dist < radius + 0.5)         cout << "*";       else         cout << " ";          }       cout << "\n";   } }   int main() {   int radius = 6;   printPattern(radius);   return 0; }
Void
#include <stdio.h> int main() { int a[10]; int i,sum=0,aver,num; for(i=1;i<10;i++) { scanf("%d",&a[i]); sum=sum+a[i]; } aver=sum/10; for(i=0;i<10;i++) { if(a[i]>aver) num++; } printf("%d",num); return 0; }
Void
Hey guys I want to output the number of numbers larger than the average,but something goes wrong and i can't find the problem🥲
Mahmoud
I will check
Void
It seems to output the number of numbers that are smaller than the average
Void
In the 2nd loop just print a[ i ] Do not increment it
But I need to output the number of numbers greater than the average🥲
Void
M
But I need to output the number of numbers greater than the average🥲
Hi, test this codes: for(I=0; i< 10; i++ ) { if(a[i]>aver) print("%d ,a[i] ); }
ʙʀʜᴏᴏᴍ ⑇
how to loop in 2D array using function!? I got this array ... when I compile the file I got a lot of errors! int arr(int value, int nums[][], int rows, int cols) { int i = 0, j = 0; for (; i < rows; i++) { for (; j < cols; j++) { if (nums[i][j] == value) return nums[i][j]; } } } and this is my main function: #include <iostream> int main() { int numbers[2][3] = {{1,2,3}{1,2,3}}; std::cout << arr(8, numbers, 2, 3) << endl; }
Andrii
Hello!?
Hello. Specify int nums[][3] in function definition and add comma between braces in array initialization
Andrii
Thank you I will do it 👍🏼
And add some return value at the end of the function if u fail to find matching numbers
klimi
Hello!?
HELLO
Anupam2.7
Why do we need to write return 0 at the end of int main() function???
Anónimo
i think because when another program calls yours, it is used to confirm that everything worked correctly
ببب ب
It's kinda strange; in C++ you have [[applies_to_function]] void [[applies_to_return_type]] f [[applies_to_function]] () [[applies_to_function_type]]; if I got that right
ببب ب
C++ what do you think?
모하마드
Hi All i'd like to ask Where can i learn best articles about c pointer, memory allocation inorder to understand the control flow?🙏🏻
Anonymous
Hello Guys...
Anonymous
Can u help me with a problem Oh no i can't share media here Anyone familiar with VSCODE , I'm having a error 🥲🥲
Yehudi S. Sanabria
Hey guys, which book (s) you recommend to start understanding C++ and the best books?
Faramarz
Is it wrong to right something inside of string part of scanf like sacnf("%d. \n", &num) I'm wondering why online gdb does not give any error.
Shinomine
Is it wrong to right something inside of string part of scanf like sacnf("%d. \n", &num) I'm wondering why online gdb does not give any error.
It's correct, you can learn more about the format string parameter of scanf here: https://en.cppreference.com/w/c/io/fscanf
ʙʀʜᴏᴏᴍ ⑇
You didn't put array[ ] in function declaration
How to do it!! Can you write any function has one araay parameter
Ludovic 'Archivist'
Did I see someone promoting hot garbage of a book?
allaine
can someone help me with my arraylist assignment pls
klimi
can someone help me with my arraylist assignment pls
do you want us to write it for you or what? you haven't provided any question or any information (and no, we won't do your homework for ya)
Pavan
How can I print name in hollow rectangle using stars
allaine
@K11M1 can u message you? i really need your help
artemetra 🇺🇦
hello! i'm remaking a board game in c, and since the game is deterministic i wanted to find the optimal moves given the state of the game. what i want to do is to build a tree (not a binary tree though) of all the moves one can make during a turn and subturns that may appear i know that the max amount of choices of moves is 6 this is (vaguely) what i am currently doing: typedef struct StateNode { Board board_state; struct StateNode* paths[6]; } StateNode; are there any better options/better practices for this?
touhou
no, not tic-tac-toe
Ok, but in there, the opponent computer computes all possible combinations to traverse through the most efficient tree to win the game. https://en.m.wikipedia.org/wiki/Minimax