Kevin
can somebody tell me , what does it mean?
Kevin
basically , in for loop
Kevin
a=b?
Kevin
i cant understand a=b meaning here
Kevin
This code through error??
No , this code didn't through error...
Kevin
I compiled it already
Kevin
Anonymous
i cant understand a=b meaning here
You know how on every loop i increments right? In every loop a is also resigned into b as well
Kevin
Nothing
Can you please elaborate..
Danya🔥
Can you please elaborate..
The code means nothing, what else do you need to hear?
Anonymous
hhh
Anonymous
What matters is thinking
Anonymous
In fact, I prefer to be taught how to think rather than how to code
Anonymous
How to think like a programmer
Anonymous
Anonymous
Author?
Its actually "think like a programmer" by v.anton spraul
Anonymous
Would it be beneficial to read this?
Yea its all about solving problems. Not to mention it uses cpp to code so its not hard to follow up
Anonymous
Assuming ur familiar with it since ur in this group
Anonymous
yeah
Kiss my Toes
https://hackingcpp.com/cpp/cheat_sheets.html#hfold5a
Pointer cheat sheet would be much appreciated
Anonymous
I want to know if there is a good video that introduces new standards such as C + + 14 and 17
𝕷𝖔𝖗𝖊𝖓𝖟𝖔
Hi friend , i sent a message before you , my problem is like you can you help me ?
Hi, I still don't know how to manage sockets (in my Operating Systems course we are now studying PIPEs)
Abdulwahab
/*Study the following c++ programs, use comments to explain each line and write output of the programs */ #include <iostream> using namespace std; void pause(); // Prototype int main() { cout << endl << "Dear reader, " << endl << "have a "; pause(); cout << "!" << endl; return 0; } void pause() { cout << "BREAK"; } /************** A program with some functions and comments **************/ #include <iostream> using namespace std; void line(), message(); // Prototypes int main ();{ cout << "Hello! The program starts in main()." << endl; line(); message(); line(); cout << "At the end of main()." << endl; return 0; } void line() // To draw a line. { cout << "--------------------------------" << endl; } void message() // To display a message. { cout << "In function message()." << endl; } // To use strings. #include <iostream> // Declaration of cin, cout #include <string> // Declaration of class string using namespace std; int main(); { // Defines four strings: string prompt("What is your name: "), name, // An empty line( 40, '-'), // string with 40 '-' total = "Hello "; // is possible! cout << prompt; // Request for input. getline( cin, name); // Inputs a name in one line total = total + name; // Concatenates and // assigns strings. cout << line << endl // Outputs line and name << total << endl; cout << " Your name is " // Outputs length << name.length() << " characters long!" << endl; cout << line << endl; return 0; } Please what's wrong here. The code is still indicating an error?
Anonymous
/*Study the following c++ programs, use comments to explain each line and write output of the programs */ #include <iostream> using namespace std; void pause(); // Prototype int main() { cout << endl << "Dear reader, " << endl << "have a "; pause(); cout << "!" << endl; return 0; } void pause() { cout << "BREAK"; } /************** A program with some functions and comments **************/ #include <iostream> using namespace std; void line(), message(); // Prototypes int main ();{ cout << "Hello! The program starts in main()." << endl; line(); message(); line(); cout << "At the end of main()." << endl; return 0; } void line() // To draw a line. { cout << "--------------------------------" << endl; } void message() // To display a message. { cout << "In function message()." << endl; } // To use strings. #include <iostream> // Declaration of cin, cout #include <string> // Declaration of class string using namespace std; int main(); { // Defines four strings: string prompt("What is your name: "), name, // An empty line( 40, '-'), // string with 40 '-' total = "Hello "; // is possible! cout << prompt; // Request for input. getline( cin, name); // Inputs a name in one line total = total + name; // Concatenates and // assigns strings. cout << line << endl // Outputs line and name << total << endl; cout << " Your name is " // Outputs length << name.length() << " characters long!" << endl; cout << line << endl; return 0; } Please what's wrong here. The code is still indicating an error?
There is a semicolon before { just after int main().
Anonymous
haha
Anonymous
Hi , i am 18 years old and i am learning C and C++ , i want to migrate because in my country because there is no room for improvement. I wanna continue my programming lessons What should i do? And how should i apply?
Abdulwahab
Please someone should help me identify the error from this code. 👇 #include <iostream> using namespace std; void pause(); // Prototype int main() { cout << endl << "Dear reader, " << endl << "have a "; pause(); cout << "!" << endl; return 0; } void pause() { cout << "BREAK"; } /****** A program with some functions and comments ******/ #include <iostream> using namespace std; void line(), message(); // Prototypes int main (){ cout << "Hello! The program starts in main()."<<endl; line(); message(); line(); cout << "At the end of main()." << endl; return 0; } void line() // To draw a line. { cout << "--------------------------------" << endl; } void message() // To display a message. { cout << "In function message()." << endl; } // To use strings. #include <iostream> // Declaration of cin, cout #include <string> // Declaration of class string using namespace std; int main() { // Defines four strings: string prompt("What is your name: "), name, // An empty line( 40, '-'), // string with 40 '-' total = "Hello "; // is possible! cout << prompt; // Request for input. getline( cin, name); // Inputs a name in one line total = total + name; // Concatenates and // assigns strings. cout << line << endl // Outputs line and name << total << endl; cout << " Your name is " // Outputs length << name.length() << " characters long!" << endl; cout << line << endl; return 0; } I kept receiving this message "int main () previously defined here" Or "Redefinition of int main ()"
Anonymous
Did you write this code in a file
Anonymous
just a file not files?
Anonymous
Please someone should help me identify the error from this code. 👇 #include <iostream> using namespace std; void pause(); // Prototype int main() { cout << endl << "Dear reader, " << endl << "have a "; pause(); cout << "!" << endl; return 0; } void pause() { cout << "BREAK"; } /****** A program with some functions and comments ******/ #include <iostream> using namespace std; void line(), message(); // Prototypes int main (){ cout << "Hello! The program starts in main()."<<endl; line(); message(); line(); cout << "At the end of main()." << endl; return 0; } void line() // To draw a line. { cout << "--------------------------------" << endl; } void message() // To display a message. { cout << "In function message()." << endl; } // To use strings. #include <iostream> // Declaration of cin, cout #include <string> // Declaration of class string using namespace std; int main() { // Defines four strings: string prompt("What is your name: "), name, // An empty line( 40, '-'), // string with 40 '-' total = "Hello "; // is possible! cout << prompt; // Request for input. getline( cin, name); // Inputs a name in one line total = total + name; // Concatenates and // assigns strings. cout << line << endl // Outputs line and name << total << endl; cout << " Your name is " // Outputs length << name.length() << " characters long!" << endl; cout << line << endl; return 0; } I kept receiving this message "int main () previously defined here" Or "Redefinition of int main ()"
if those all in a file, the reason is a C/C++ code cant repeat the main function
Amrith
Please someone should help me identify the error from this code. 👇 #include <iostream> using namespace std; void pause(); // Prototype int main() { cout << endl << "Dear reader, " << endl << "have a "; pause(); cout << "!" << endl; return 0; } void pause() { cout << "BREAK"; } /****** A program with some functions and comments ******/ #include <iostream> using namespace std; void line(), message(); // Prototypes int main (){ cout << "Hello! The program starts in main()."<<endl; line(); message(); line(); cout << "At the end of main()." << endl; return 0; } void line() // To draw a line. { cout << "--------------------------------" << endl; } void message() // To display a message. { cout << "In function message()." << endl; } // To use strings. #include <iostream> // Declaration of cin, cout #include <string> // Declaration of class string using namespace std; int main() { // Defines four strings: string prompt("What is your name: "), name, // An empty line( 40, '-'), // string with 40 '-' total = "Hello "; // is possible! cout << prompt; // Request for input. getline( cin, name); // Inputs a name in one line total = total + name; // Concatenates and // assigns strings. cout << line << endl // Outputs line and name << total << endl; cout << " Your name is " // Outputs length << name.length() << " characters long!" << endl; cout << line << endl; return 0; } I kept receiving this message "int main () previously defined here" Or "Redefinition of int main ()"
Read your assignment question carefully. Its three different programs and i think 3 separate questions
Евгений
which country btw?
What d'you mean?
Anonymous
Hii
Anonymous
Can i get java code for attendance management system?
Anonymous
If I'm not mistaken, here seems to be c
DarkEnergy
Hey guys. cpp newbie here.. a quick question about the vector.end() iterator in the context of vector.insert()
DarkEnergy
class Solution { public: void rotate(vector<int>& nums, int k) { cout << *(nums.end() - k); nums.insert(nums.begin(), nums.end()-k, nums.end()); } };
DarkEnergy
for a test case where vector<int> nums = {1,2,3} and k = 1, the above code would change the vector to {2,2,1,3}. why doe the it append “2” to the beginning of the vector, not “3”? ( cout however prints “3” though)
DarkEnergy
I googled around but can’t find the root cause.. any input is appreciated. thanks guys!
Marcio
How to access the OT group?
PHATHUTSHEDZO
Good day everyone Anyone to help me with explaining thoroughly The C programming function implementation??
Faramarz
typedef struct{ char name[30]; float height; }person_s; Hello, Do you know why sizeof this struct is 36 not 40?
Marcio
print sizeof(float) and you will know.
Faramarz
I did it is 36 but shouldn't be a factor of 8 which is 40?
Marcio
It changes from machine to machine. This is the reason many books advice to use sizeof if you are working close to the machine.
Marcio
Maybe the factor is 4, so 32 to the array plus 4 to the float.
Anonymous
which country btw?
America or Germany or Canada
Faramarz
Maybe the factor is 4, so 32 to the array plus 4 to the float.
Yeah That's right because here I have float not double
Anonymous
first
Anonymous
You need to see what your compiler is
Anonymous
Vs or vscode or something
Anonymous
this involves memory alignment
Anonymous
bc 32 is a multiple of 8🥱
Anonymous
2 4 8 16 32 64
Anonymous
VS I remember the default alignment number is 8
David
1 #include <stdio.h> 2   3 int numOfDivisors(int n); 4 void storeDivisors(int n,int a[],int *x); 5   6 int main(){ 7     int number; 8     int a[100]; 9     int x = 0; 10     int i; 11   12     // user should input the parameter 13     printf("Enter the paramter(+ interger): "); 14     scanf("%d",&number); 15   16   17     storeDivisors(number,a,&x); 18   19     for(i=0;i<x;i++) 20         printf("%d\n",a[i]); 21     printf("number of divisors = %d\n",x); 22   23     return 0; 24 } 25   26 int numOfDivisors(int n){ 27     int i, numOfDivisors=0; 28   29     for(i=1;i<=n;i++) 30     { 31         if(n%i==0) 32         { 33             numOfDivisors++; 34         } 35     } 36     return numOfDivisors; 37 } 38   39 void storeDivisors(int n,int a[],int *x){ 40     int i; 41     for(i=1;i<=n;i++) 42     { 43         if(n%i==0) 44             a[(*x)++]=i; 45     } 46 }
David
so basically i want the divisors to enter a .txt file i created
David
instead of printing in the console
AGEGNEHU
I'm not understand
D
Guys
D
Any one can help me to do this
Anonymous
I think it's output redirection
Anonymous
enter the results into the txt instead of the terminal
Anonymous
instead of printing in the console
C language can use FILE* members
Eduardo
Thank you
Libertas
Hey, i have a C question, i have a word that i read from keyboard, and alpfabed as a string. I need to parse the word and to find what index is each letter in alphabet string, so i came with this decision void *encode(char str[100], char alpha[26], char initialAlpha[26], size_t n) { int Index; int stringLength = strlen(str); for (int i = 0; i < stringLength; i++) { for(int j = 0; j < n; j++) { // printf("%d\n\n", strcmp(str[i], initialAlpha[j]) == 0); if (strcmp(str[i], initialAlpha[j]) == 0) { // str[i] = alpha[j]; printf("%c ", alpha[j]); } } } printf("%s", str); } but it returns nothing to me and shows that str[i] and initialAlpha[j] are char but should be Char * but when i add & in front of them error dissapear but it isn’t working as it should :c what should i do?