Свят
Hi guys right now I'm facing a problem that I can't get the index of the last element in array that consists of structures. I've tried to use size() method however it didn't worked for me(it outputs an error when I use it). Is there any easy way to do it?
\Device\NUL
Why not fstream tho
Свят
this code saves some data to the binary file and reads that data
Свят
Why not fstream tho
idk just found nice video that explains how to do it
\Device\NUL
idk just found nice video that explains how to do it
Imo, it's a bad idea to mix iostream with cstdio
pavel
size () of raw array? Nani!?
pavel
Size of your array always 100, you don't count how many elements you fill in this arr
İbn
Write a program in C++ that defines a single array of 50 int positions, generates random numbers in this array, rotates the array elements left by 5, and prints every 5 elements in a row??
Hussein
#paste
betterpoint
Hi guys right now I'm facing a problem that I can't get the index of the last element in array that consists of structures. I've tried to use size() method however it didn't worked for me(it outputs an error when I use it). Is there any easy way to do it?
Array doesn't have size() method. Just create another int variable to store the number of elements in the array. Or you may use STL vector instead of an array, which does have a size() method.
conko
the easiest way to get the size of an array may be std::end(arr) - std::begin(arr), it uses array reference to get the size of array
conko
#question #fraction Hi everyone, is there a method in c++ to convert a number to fraction? such as in python: from fractions import Fraction print(Fraction("0.5")) ----- Output: 1/2
There's no equivalent to python's fraction type in C++ standard library, but there is an interesting compile time rational arithmetic tool std::ratio
conko
https://en.cppreference.com/w/cpp/numeric/ratio/ratio
conko
I dont think this is what you need though
Muhammad Ali
I dont think this is what you need though
Yeah, anyway thanks 👍🏻
Anonymous
#include<stdio.h> int main() { int son,son2,i,p; printf("Son kiriting:\n"); scanf("%d%d",&son,&son2); while(i=son && i<=son2) { p=sqrt(i); if(p*p==i) { printf("%d,",i); i++; } } } only shows the number 1 so help help me
Khadija
Hi guys please what I have to do ?: I wrote my prgrm and when I tried to compile it, There is en error (-fpermissive) ? Please can anyone help me or tell me what does it mean?
pavel
This flag force you strictly follow standard
Khadija
Ahh okeyy
Khadija
Thank you so much
Anonymous
Which one?
result (
Anonymous
Which one?
only shows the number 1 so help help me
Null
2ta kitilgan sonning kvadratimi?
Null
oh ok sorry
Null
#include <math.h> #include <stdio.h> int main() { int son,son2,x,y; scanf("%d %d",&son,&son2); x = pow(son, 2); y = pow(son2, 2); printf("1son kvadrati = %d\n", x); printf("2son kvadrati = %d\n", y); return 0; }
Null
What are you trying to do?
find square of num lol
Anonymous
find square of num lol
Why you write too many steps it's too easy by the way
Anonymous
yeah cuz im intern c dev)
#include<stdio.h> int main() { int son,son2,i,p; printf("Son kiriting:\n"); scanf("%d%d",&son,&son2); for(i=son;i<=son2;i++) { p=sqrt(i); if(p*p==i) { printf("%d,",i); } } }
Alex
hi guys, how can i use multiple alarms in C?
pavel
Alarms, nani?
Alex
yeah alarm() the first call always works, the others nope
pavel
Its not about c++. How do you going to use alarm function multiple time ? How do you check it doesn't work?
Anonymous
Which online complier is good for c programming
Anonymous
Because most of the online complier doesn't compile the code
Talula
Because most of the online complier doesn't compile the code
Do you mean they do not compile it to .o or they do not compile particular code?
\Device\NUL
Because most of the online complier doesn't compile the code
You must be using non standard code or your code is wrong
Hussein
Because most of the online complier doesn't compile the code
use a real compiler on an actual computer if you can or use a linux machine emulator
Anonymous
I sugget onlinegdb
I tried it before, it’s simple but also lacks on some features.
Anonymous
“GodBolt” is like Swiss knife or AK-47 of online compilers…
Anonymous
Does it have debugger?
It depends on what you mean by “debugger”, if you mean debugging the binary code and its structure, the answer is (yes)
Ruslan
Hi! undefined reference error. What is wrong here? Compile comand: g++ -Wall -Wextra -Wpedantic -g -O3 -I/usr/include/opencv4/ -L/usr/lib/x86_64-linux-gnu/ fdt.cpp -o fdt All the necessary libs are placed in /usr/lib/x86_64-linux-gnu/.
Ruslan
Any code/error messages?
Solved right now, just compiled with CMake successfully.
Robert
Owner, pm me pls
👾
Hello guys I’ve learned basics of c++ what should i do next to improve my coding skills ! I mean i wanna explore more and i wanna improve my coding skills ( the different ways to write codes ) and solving skills !
👾
Ok I’ll try
Hussein
Hello guys I’ve learned basics of c++ what should i do next to improve my coding skills ! I mean i wanna explore more and i wanna improve my coding skills ( the different ways to write codes ) and solving skills !
learn about the functions in the standard library. just read about them to know your options when you are programming then start a project and google everything you don’t know how to make or ask for help
👾
Alright guys ! 🙏🏻😊
Anonymous
Hi friend i have a question Which one of these are true 1) A = B ; C = D ; 2) A,C = B,D ; 3) A = B , C = D ;
Abdelghani
Hi there I started learning c but I feel stack, can you help me improve. Any tip for a beginner!
pavel
Follow exercises from a book for first
pavel
Then dо pet project
Pavel
Here, I googled this for you https://medium.com/@derya.cortuk/c-pointers-683d0e39c650
Anonymous
Don’t answer people who PM you and ask for help, 30 mins later you realize that you’ve been writing the whole project for them for nothing 👎 Their questions are endless and unfortunately the only thing they want is the whole project’s source code and not learning the subject! #related
\Device\NUL
There are tons of people that dm-ed me, I told them to ask in the group instead
Hussein
Here, I googled this for you https://medium.com/@derya.cortuk/c-pointers-683d0e39c650
“pointers can cause unreadable and unmaintainable code or memory leaks and buffer overflows” while me programming in C for the last 3 yrs 🤣🤣🤣
Hussein
yep with C pointer are unavoidable
Hussein
Pointers…. Memory-leaks…. WTF?!!!
but it is not a big deal because after 6 months of programming in C you will start doing the job of a garbadge collecter easily and more efficiently