Talula
Why ?
Because when you call a different memory area and pass on the value on stack, it takes more cycles compared to a loop, which is jumping with compare.
Pavel
Sum of 2d array sounds ambiguous: is it sum of all elements of an array or sum of two matrices
mito
Isn't this called pascal's triangle? I remember someone asking the same thing in another group..
Deniz Özgür
#include <Windows.h> #include <iostream> int nScreenW = 120; int nScreenH = 30; int main() { wchar_t* screen = new wchar_t[nScreenW * nScreenH]; for (int n = 0; n < nScreenW * nScreenH; n++) { screen[n] = L' '; } HANDLE hConsole = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL); SetConsoleActiveScreenBuffer(hConsole); DWORD dwBytesWritten = 0; int i; while (true) { for (i = 0; i < nScreenW * nScreenH; i++) { screen[i] = 0x2588; } WriteConsoleOutputCharacter(hConsole, screen, nScreenW * nScreenH, { 0, 0 }, &dwBytesWritten); } return 0; }
Deniz Özgür
I want to change command line row and column from nScreenW and nScreenH valuables
Deniz Özgür
Also character width, height and color how I can do?
Knights
Good evening How do I check if an input is an integer Thanks
Knights
Good evening How do I check if an input is an integer Thanks
I want the program to take integer inputs only If the input is not an integer, the user should be prompted to enter an integer value
klimi
Good evening How do I check if an input is an integer Thanks
You can check if it is digit or you can try converting it with a check
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
klimi
What about isdigit()?
That would be the first part of my answer :)
Knights
I’ll try that
klimi
In your case the second option: strtol() might be better
.
Hello
.
can someone help me with this: CI = p * (pow((1 + r / 100), t)); how should i change the formula if i want to find r?
.
Thank you!
Anonymous
Thank you!
Stick to C/C++ questions in the future. This is not a Maths group to help you with Compound Interest formula
Anonymous
Check MSDN it's great documentation for the Windows API
Anonymous
Refer geeksforgeeks
mayway
Random_number=rand()%max+min;.. Random_number=rand()%(max-min+1)+min;..... Whats the difference between them???
Pavel
Random_number=rand()%max+min;.. Random_number=rand()%(max-min+1)+min;..... Whats the difference between them???
First will give a random value in a range [min; min+max) Second gives a random value in a range [min; max]
Пингвинтус
Hello guys, I'm a beginner in programming and currently struggling with one task, if someone could help me, I'd very thankful (c++)
Otumian
Hello guys, I'm a beginner in programming and currently struggling with one task, if someone could help me, I'd very thankful (c++)
I don't think you'd be asked to share you task/issue. So do so and anyone of the 14939 members of which over 500 are online, will help if they can
ruki
hi eveyone, now xmake has supported c++20 modules and analyze inter-module dependency compilation, and parallel compilation optimization welcome to try it. https://github.com/xmake-io/xmake/wiki/xmake-v2.5.9-released,-Improve-Cplusplus20-Modules-and-support-Nim,-Keil-MDK-and-Unity-Build
Gudisa Gebi
#include <iostream> using namespace std; struct Person{ int age; struct Person*link; }; void addAtEnd(Person *head, int x) { Person *temp= new Person; temp->age=x; temp->next = NULL; // Person *ptr= head; while(ptr->next !=NULL) ptr = ptr->next; // ptr->next=temp; } int main(int argc, char** argv) { Person *head= new Person; head->age=23; head-> next= NULL; // addAtEnd(head,24); addAtEnd(head,25); addAtEnd(head,26); return 0;
Ka. LOVE |• kalhim ng ilaw • TSV: Lokal ng SUCAT
what is wrong with code
If i choose number for magic tricks in the last part it will not show what i choose
Ka. LOVE |• kalhim ng ilaw • TSV: Lokal ng SUCAT
Try to run the code🥺
Anonymous
Anonymous
Probably a 'typo'
Angel Anne
Hi everyone can someone help me with this 🙏🏻🙏🏻 Create a c program that will perform the given below using array, conditional statements and loops. -input 5 grades in an array -determine if the input grade is passed of failed -then count how many grades are passed or failed
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Hi everyone can someone help me with this 🙏🏻🙏🏻 Create a c program that will perform the given below using array, conditional statements and loops. -input 5 grades in an array -determine if the input grade is passed of failed -then count how many grades are passed or failed
int main() { int Grades[5]; int gradespassed = 0; int gradesfailed = 0; for(int i = 0; i <5; i++){ printf("Enter Grade %d:", i+1); scanf("%d", &Grades[i]); } printf("\n"); // Since Pass Grade was not Specified , everything above 39 is a Pass mark here for(int i =0; i <5; i++){ if (Grades[i] > 39){ printf("Grade %d: Passed!\n",Grades[i]); gradespassed ++; } else { printf("Grade %d: Failed! \n", Grades[i]); gradesfailed++; } } printf("\nGrades Passed are %d.", gradespassed); printf("\nGrades Failed are %d.", gradesfailed); return 0; }
Anonymous
想改hosts
Anonymous
sizeof operator might work
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
If there’s a built in function to detect the size of the array then use that
I think the question already gave the size of the array Maybe i don’t get what you mean so if you could explain further
Anonymous
Sizeof returns the size of bytes
ARx
for (int i = 0; i < sizeof(grades); i++
but in that case there should be a / sizeof(*grades) after the sizeof(grades). Anyway the problem give the length so there's no reason to make it more generic
ARx
or you can also use #define GRADES 5
Anonymous
There’s a len function in other languages I’m not sure what’s the best way of doing it, but it’s probably sizeof
ARx
That's more appropriate in generic programs, you can also declare a variable for length size_t length = sizeof(array) / sizeof(array[0])
The WARRIOR
What is .CPP and .h files in c++. What is header guards and how it useful?..could someone help me
ARx
What is .CPP and .h files in c++. What is header guards and how it useful?..could someone help me
.cpp is the file where you write all your functions or programs in c++ language
ARx
.h is a file which contain declarations of functions related to something, you can use for example a math header "math_functions.h" file where you declare functions as multiplication, add, power, etc
Shobhit
Is there any way to fix no file or directory find in vs code terminal???? ....
ARx
then you can include the header, and you are able to use all the functions it contains
ARx
Implemtation of methods..
yeah i think, i don't know c++, but headers are similar to C I think
The WARRIOR
Tnxs Alan...👍👍
ARx
Tnxs Alan...👍👍
You're welcome :))
Shobhit
I just started coding Not much familiar with vs cide
ARx
use pwd if you are in linux to know where you are
Anonymous
Please please check dm
It’s often useful to check the Linux Programmers manual for functions like printf for example man 3 printf or man 3p printf, the 3p section is the POSIX section but 3 is more relevant
Anonymous
and you can also learn about commands via man <command>
Anonymous
Hi everyone Can you write any C programming that make the program end only when user enters “0 0 0”
Anonymous
We can, can you?
No please help me
klimi
what's the problem?
klimi
you don't know how to exit the C program? get the user input? compane 2 strings?
Anonymous
I dont know strings
Anonymous
As a string or char array
Anonymous
actually, i wrote a program but when i write 0 0 0, it doesn't end
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
actually, i wrote a program but when i write 0 0 0, it doesn't end
Bro would like to help but don’t seem to get your question well
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
actually, i wrote a program but when i write 0 0 0, it doesn't end
Does the problem have any any other lines of code?