Md
Write std::string directly
show me an example please
Artur
I already did
Artur
Read up about namespaces in C++
Artur
And also instead of getch() I would recommend using std::cin.get();
100$ website
:D
will need your help, am learning something which is in hindi facing problem with understanding the logic can i send you the YT vid link with starting time to ending time!!?
Anonymous
Right there there is an undefined behaviour, and sometimes in a bit larger projects it can lead to some nasty issues
No. A 0 is returned when the end of main is encountered without a return statement. There is no Undefined Behavior when you leave out the return from main.
Alviro Iskandar
> even when I defined it before? what do you mean by that? can't understand your question
Sunflower
Hello. I had a question. Is it possible to track a third party which installs software or extensions or on a computer ?
\Device\NUL
the best for everyone
// Insertion Sort #include <stdio.h> void Insertion_Sort(int a[], int length) { // two loops the first one to go to each elements of the numbers // and the second one to shift to right position and to go to the suitable place of it int temp, whole; for (int i = 1; i < length; i++) // it will start form 1 when it puck up it { temp = a[i]; // it will get it out for temporary to compare it with the others whole = whole - 1; // becuase it will start form right to left and it will subtract a number of elements of the index // and as long as they are subtracting while (whole > 0 && a[whole - 1] > temp) { a[whole] = a[whole - 1]; // to shift to from right to left position and to go to the suitable place of it whole = whole - 1; // to fix it and make it much better again (to update it ) } a{whole + 1} = temp; } } int main() { int a[] = {8, 4, 9, 5, 7, 6, 3, 2}; Insertion_Sort{a, 8}; // the size of it or the length of it for (int i = 1; i < 8; i++) printf("a[%d] = %d \n", i a[i]); return 0; }
the best for everyone
what ıs the mıstake ın thıs code :
the best for everyone
?
Turşihan
#include <stdio.h> #include <stdlib.h> struct regist { char name[15]; char surname[15]; unsigned pernum; }emp,persons[1000],spare[1000]; FILE *fp; void addEmp(void) { fp = fopen("C:\\Users\\dlny\\Desktop\\odev1\\dolunayaltindag.txt","a"); printf("Ad : "); scanf("%s",emp.name); printf("Soyad : "); scanf("%s",emp.surname); printf("Personel Numarasi : "); scanf("%d",&emp.pernum); fprintf(fp,"%d\t%s\t%s\t\n",emp.pernum,emp.name,emp.surname); fclose(fp); } void removeEmp(unsigned tobeDeleted) { int a=0,i,which; struct regist names[1000],surnames[1000],pernums[1000]; fp = fopen("C:\\Users\\dlny\\Desktop\\odev1\\dolunayaltindag.txt","r"); while( !feof(fp) ) { fscanf(fp,"%d %s %s",&spare.pernum[a],spare.name[a],spare.surname[a]); ++a; } for(i=0;i<a;++i) { if(tobeDeleted==spare.pernum[i]) { which=i; } } } void listTheEmps(void) { fp = fopen("C:\\Users\\dlny\\Desktop\\odev1\\dolunayaltindag.txt","r"); while( !feof(fp) ) { fscanf(fp,"%d %s %s",&emp.pernum,emp.name,emp.surname); printf("%d\t%s\t%s\n",emp.pernum,emp.name,emp.surname); } fclose(fp); } int main(void) { unsigned select,again=0; unsigned tobeDeleted; do{ system("CLS"); printf("MENU==================\n"); printf("1>Kayit Ekleme\n2>Kayit Silme\n3>Kayit Guncelleme\n4>Kayitlari Listeleme\n5>Cikis\n"); printf("Secim: "); scanf("%d",&select); switch(select) { case 1: addEmp(); printf("Kayit basariyla eklendi.\nMenuye tekrar gitmek icin 1'i tuslayiniz...\n"); scanf("%d",&again); break; case 2: printf("Silinecek kisinin calisan numarasini giriniz : "); scanf("%d",&tobeDeleted); removeEmp(tobeDeleted); break; case 3: break; case 4: listTheEmps(); printf("\n\nMenuye tekrar gitmek icin 1'i tuslayiniz...\n"); scanf("%d",&again); break; case 5: system("CLS"); printf("Iyi gunler dileriz...\n"); return 0; default: printf("Hatali secim yaptiniz. Tekrar denemek icin 1'i tuslayiniz.\n"); scanf("%d",&again); } }while(again==1); return 0; }
Turşihan
I could not delete and update the file from the file. Can you help me ?😕
Ravi
what is wrong here??
Here nam[6] represent char array with nam char pointer pointed to index 6 where Only you can put one char....eg:- nam[6] = 'C' ... but you are trying to initialise a string which is wrong ..
Kartik
Hi, like we insert numbers in a set(stl), can we insert vectors into a set? If yes, how? If no, any article showing how to remove duplicate vectors, from vector of vectors?
\Device\NUL
Is plan9 still alive these days ?
♾️
Is plan9 still alive these days ?
9front but sadly not modern enough for really being usable for normal people
\Device\NUL
♾️
Even C compiler on it not supporting ANSI Standard
Yes but the good thing about the c compiler is that it actually is compiling c and not Assembly
♾️
I haven't see its assembly. How the syscalls ?
I never really looked into it’s assembly because they try to not use it only where it is really needed but I think it’s similar to go assembly because go assembly is based on it.
♾️
Is there a good example implementation of icccm (not everything) in c?
Odilkhon Yakubov
Hi there
Odilkhon Yakubov
My name is Odilkhan Yakubov
Odilkhon Yakubov
I'm Blender 3d users since 2012
Odilkhon Yakubov
And I'm considered on edit some codelines on source for some svm_closure
Ludovic 'Archivist'
Even C compiler on it not supporting ANSI Standard
I rather like Plan9 C Compiler (and the Plan9 ecosystem and legacy in general)
ranz
try something so we can help
Tushar
Yeah
Tushar
just take a number like 456 on a piece of paper and see how would you play around with it, like extract 1 digit at a time and then see how will you reverse it
Tushar
Okk
Aztec
https://pastebin.com/0V2C4Te2 I’m trying to sort a string of names in ascending order with this code but I’m having an error (The names are sorted alright but there are some garbage alphabets added to some of the names) It works fine when i use the swap() function to swap the names but only gives me the error when i use the for loop Been trying to figure the error out for a long time so someone please help me if you can🙂
Tushar
Did you get it?
Tushar
Hi
No Name
hey i have a problem with my code, it prints the wrong number for somereason can somebody take a look at it ? #include <stdio.h> int recieveVectorA(int n); int recieveVectorB(int n); int calculate(int vectorA[],int vectorB[],int n); int main(){ int i, n; int result = 0; int vectorA[n],vectorB[n]; printf("Please write the size of the vectors\n"); scanf("%d", &n); recieveVectorA(n); recieveVectorB(n); calculate(vectorA, vectorB, n); } int calculate(int vectorA[],int vectorB[],int n){ int i = 0; int result = 0; for ( i = 0; i < n; i++) { result += vectorA[i]*vectorB[i]; } printf("The inner product of these two vectors is %d\n", result); } int recieveVectorA(int n){ int i = 0; int vectorA[n]; printf("Write vector A:\t"); for(i = 0; i < n; ++i) { printf("Term %d = ", i); scanf("%d", &vectorA[i]); } } int recieveVectorB(int n){ int i = 0; int vectorB[n]; printf("Write vector B:\t"); for(i = 0; i < n; ++i) { printf("Term %d = ", i); scanf("%d", &vectorB[i]); } }
No Name
it prints "The inner product of these two vectors is 1451566208"
klimi
have you tried valgrind?
No Name
have you tried valgrind?
no idea what that means
klimi
um.. it's good sanitizer for memory access
klimi
run your program with valgrind ./your_binary
No Name
run your program with valgrind ./your_binary
its a task so im pretty sure im not allowed to use anything else
No Name
(school task)
klimi
uh
klimi
so you are not allowed to run your code?.... okay...
klimi
well i am wondering if you really cannot run valgrind, but you can ask for help on the internet
klimi
which would valgrind detect
Alviro Iskandar
its a task so im pretty sure im not allowed to use anything else
if you are not allowed to run valgrind, how are you allowed to ask on this group? stop saying stupid thing like that, you are just too lazy to debug your program
No Name
i had no idea what it means, i thought its a tool or something
No Name
why are you talking in this way before you ask what is my status? you can see i ask stupid questions, cant you get to a conclusion that im new ?
No Name
well i am wondering if you really cannot run valgrind, but you can ask for help on the internet
ill try it myself thank you, i wasnt familiar with valgrind, ill google it
Emi GR
hai all, I wanna ask a question. If the program want you to input 50 but the other side the program want the output to be just 5. How to make that?? Do I need to add other data type? Thankyou.
Anonymous
Hi, everyone. I am looking for a job now. If someone needs help, I willing to help you. Thank you.
Resul
There is a c program that contains two main functions. I want to run one at value. How can I do it? I can read it with fopen.
Anonymous
Hi my friend
Anonymous
I need help you
Anonymous
Please private message me I need to write a code
Viking
Any good c++ advanced interview questions and white board interview PDF please 🙏
♾️
Maybe optimize the gnu assembly by using -savetempts (or another flag I’m not sure) as compile flag in gcc or g++
the best for everyone
so how can I use them in c language ?
the best for everyone
how the program should be ?
Anonymous
*The tuition fee for Data link institute is $2000 per year. Suppose the university financial committee recommends that tuition should be increased at an annual rate of 5%. Write a program that uses a loop to compute the tuition in ten years.* Please can someone help me with this
Dima
lol at first I thought it was a spam message
r3tr0m
Hi
Anonymous
Am a beginner