🙋🏻‍♂️
How can I make a recursive function on my project? I couldn't add. Who can help?
LeBouy
Write a function that takes three input arguments: a character and two integers. The character is to be printed. The first integer specifies the number of times that the character is to be printed on a line. The second integer specifies the number of lines to be printed. Write a C program that makes this function.
𝕶𝖎𝖔𝖏𝖊𝖊𝖓 ⁞𒄩𒊓𒉡
Hi, i need Qt tools for visual studio 2022 And when i download it from the marketplace i can't find the folder called "Qt" in mu directory Can someone help me?
𝕶𝖎𝖔𝖏𝖊𝖊𝖓 ⁞𒄩𒊓𒉡
https://doc.qt.io/qtvstools/qtvstools-getting-started.html
In this documentation it tells me to add the path "C:\Qt\6.2.0\msvc2019_64\bin\qmake.exe" Which is not in my computer And that's my problem
zakaria
hey, I need some quick tutorials in oop c++, and some practice exercises can someone help? thanks in advance
Stanislav
In this documentation it tells me to add the path "C:\Qt\6.2.0\msvc2019_64\bin\qmake.exe" Which is not in my computer And that's my problem
1. did you install qt using Qt installer? default installation location is 'C:\Qt' 2. add this installation path to qt tools
𝕶𝖎𝖔𝖏𝖊𝖊𝖓 ⁞𒄩𒊓𒉡
Stanislav
I did install it using the extension installer in vs 2022
extension installer installs only extension :)
𝕶𝖎𝖔𝖏𝖊𝖊𝖓 ⁞𒄩𒊓𒉡
qt-vsaddin-msvc2022-2.8.0.vsix
𝕶𝖎𝖔𝖏𝖊𝖊𝖓 ⁞𒄩𒊓𒉡
extension installer installs only extension :)
Qt installer has only mscv 2019 and less
Stanislav
Qt installer has only mscv 2019 and less
msvc2019-2022 abi compatible
𝕶𝖎𝖔𝖏𝖊𝖊𝖓 ⁞𒄩𒊓𒉡
msvc2019-2022 abi compatible
i will download then , thanks
Anonymous
i have exam from 2pm to 3pm ist c program till pointers easy for all of you please help anyone will?
Anonymous
#include <stdio.h> int main() { char a [10]; printf("Hey buddy\n"); printf("Enter Your subject "); scanf("%s", &a); if (a = math) { printf("You got 15 rupees"); } else if (a = science) { printf("You gor 20 rupees"); } else { printf("You got nothing"); } return 0; }
Anonymous
i want to take string as an input
Ävïraj singh
Can anyone explain me the arrays and strings and how we use that in our code of c
Anonymous
Can anyone explain me the arrays and strings and how we use that in our code of c
A string is a combination of characters i.e. "john","james" while array is a collection of elements thats are of the same type i.e. {4,5,6} or {"john","james"}
Anonymous
The difference between array and strings is that strings usually combines characters while array can combine both characters and numbers
Ävïraj singh
Ok sir 😊😊 thanks
%Nikita
Well, this is UB, it's completely correct if the compiler optimizes that away because this code is incorrect from the beginning.
Oh, I didn’t know that changing const variable by pointer to non-constant variable is actually ub. Thanks you for info anyway
Pavel
Because it sounds common
There are two different situation: Modifying const variables and modifying non-const variables through pointer to const/(const ref in C++). None of them is common, I would say, but only the second is "fine", the first is UB. Here are a couple of examples in the first answer: https://stackoverflow.com/questions/58170163/is-it-ub-to-modify-where-pointer-points-when-original-data-is-const
%Nikita
#include <stdio.h> int main() { char a [10]; printf("Hey buddy\n"); printf("Enter Your subject "); scanf("%s", &a); if (a = math) { printf("You got 15 rupees"); } else if (a = science) { printf("You gor 20 rupees"); } else { printf("You got nothing"); } return 0; }
I saw some strange things here. 1. > scanf(“%s”, &a); If you take an address of statically allocated array you will get the same value, that you got before taking an address. Ampersand is optional here, but it will still work. To make it easier to read try gets(s) from <stdio.h>. 2. > if(a = math) You haven’t got any variable called math. It will be an error. If you want to compare “a” array with char[5] "math" literal, then try int strncmp(s1, s2, n) from <string.h>. Also you need to create “math” string. Not math variable. You can do the same for all your else-if construction. ( Btw If you declare variable called math, this code is still incorrect. To compare two things you need to use comparative operator “==“, not setting value operator “=“. But comparing address with a variable is UB. )
Anonymous
https://ideone.com/3ua8dd can someone pls help me, I don't understand why I'm getting segmentation fault error...
Anonymous
solo learn also here
Anonymous
sololearn
%Nikita
%Nikita
Btw, I just noticed that my antivirus ( Kaspersky ) detect segfault as malware. It is kind of interesting… Maybe it detects memory leaks too? If it is, then it seems like kinda debug tool 😀
Artur
Have Kaspersky as well never had that one 😅
Anonymous
It seems that something went wrong, and for some reason I can’t open this link
#include <iostream> #include <string> using namespace std; struct EZTechMovie { string name; string cast; string rating; }; int main() { struct EZTechMovie *movie; // movie.cast = new string; string selection; int numOfMovie; cout << "Would you like to add a new movie? "; cin >> selection; numOfMovie = 0; movie = new struct EZTechMovie; while (selection == "Yes" selection == "yes" selection == "Y" || selection == "y") { getchar(); numOfMovie++; movie = (struct EZTechMovie *)realloc(movie, numOfMovie * sizeof(struct EZTechMovie)); cout << "Movie Name: "; getline(cin, movie[numOfMovie - 1].name); cout << "Cast: "; getline(cin, movie[numOfMovie - 1].cast); cout << "Rating: "; getline(cin, movie[numOfMovie - 1].rating); cout << endl << "Do you need to add another movie? "; cin >> selection; } for(int i = 0; i < numOfMovie; i++){ cout << "**********" << endl; cout << "You entered" << endl; cout << "Movie Name: " << movie[i].name << endl; cout << "Cast: " << movie[i].cast << endl; cout << "Rating: " << movie[i].rating << endl; cout << "**********" << endl << endl; } return 0; }
Anonymous
this is the actual code...
me
Hello can any one help me ?
me
Given an nxn matrix A. Here n is number of row and column. Write a recursive function to find the sum of the diagonal elements of A. Example: 3 2 1 6 3 4 9 8 3 Output 9
me
#include<stdio.h> int sum(int n),result; int main() { int i,j,n,sum_array_elements; float a[10][10], sum=0.0; printf("Enter order of matrix:\n"); scanf("%d", &n); printf("Enter matrix elements:\n"); for(i=0;i< n;i++) { for(j=0;j< n;j++) { printf("a[%d][%d]=",i,j); scanf("%f", &a[i][j]); } } result = sum_array_elements(a,n); printf("sum = %d", result); return 0; } int sum_array_elements( int a[], int n ) { if (n ==1) { //base case: return 1; } else{ //Recursion: calling itself return arr[i],[j] + sum_array_elements(arr, n-1); } }
me
i wrote this code but only got errors
Tushar
you need to do sum = sum + sum_array_elements(arr, n-1); and then return sum I think
Tushar
cause you are not adding sum anywhere
مــــــــســــــعـــود
&a[i][j] not correct use without &
Aman
/warn
مــــــــســــــعـــود
Correct use sum_array_elements = sum_array_elements + sum(arr, n-1);
me
#include<stdio.h> int sum_array_elements(int n),result; int main() { int i,j,n; float a[10][10], sum=0.0; printf("Enter order of matrix:\n"); scanf("%d", &n); printf("Enter matrix elements:\n"); for(i=0;i< n;i++) { for(j=0;j< n;j++) { printf("a[%d][%d]=",i,j); scanf("%f", &a[i][j]); } } result = sum_array_elements(&a[i][j] ,n); printf("sum = %d", result); return 0; } int sum_array_elements( int &a[i][j] , int n ) { if (n ==1) { //base case: return 1; } else{ //Recursion: calling itself sum_array_elements = sum_array_elements + sum(&a[i][j], n-1); } }
me
got this error
me
gcc /tmp/1VEdlL73Cu.c -lm /tmp/1VEdlL73Cu.c: In function 'main': /tmp/1VEdlL73Cu.c:20:33: warning: passing argument 1 of 'sum_array_elements' makes integer from pointer without a cast [-Wint-conversion] 20 | result = sum_array_elements(&a[i][j] ,n); | ^~~~~~~~ | | | float * /tmp/1VEdlL73Cu.c:2:28: note: expected 'int' but argument is of type 'float *' 2 | int sum_array_elements(int n),result; | ~~^ /tmp/1VEdlL73Cu.c:20:14: error: too many arguments to function 'sum_array_elements' 20 | result = sum_array_elements(&a[i][j] ,n); | ^~~~~~~~~~~~~~~~ /tmp/1VEdlL73Cu.c:2:5: note: declared here 2 | int sum_array_elements(int n),result; | ^~~~~~~~~~~~~~~~~~ /tmp/1VEdlL73Cu.c: At top level: /tmp/1VEdlL73Cu.c:26:30: error: expected ';', ',' or ')' before '&' token 26 | int sum_array_elements( int &a[i][j] , int n ) { | ^
مــــــــســــــعـــود
int sum(int[][] data, int x, int n1, int y, int n2) { if (n1 == 1 && n2 == 1) { return data[x][y]; } if (n1 == 1) { return sum(data, x, n1, y, (n2 / 2)) + sum(data, x, n1, y + (n2 / 2), n2 - (n2 / 2)); } else { return sum(data, x, (n1 / 2), y, n2) + sum(data, x + (n1 / 2), n1 - (n1 / 2), y, n2); } }
me
int sum( int[][] a, int n ) { if (n ==1) { //base case: return 1; } else{ //Recursion: calling itself sum = sum + sum(a, n-1); } }
me
gcc /tmp/1VEdlL73Cu.c -lm /tmp/1VEdlL73Cu.c:26:14: error: array type has incomplete element type 'int[]' 26 | int sum( int[][] a, int n ) { | ^ /tmp/1VEdlL73Cu.c:26:14: note: declaration of multidimensional array must have bounds for all dimensions except the first /tmp/1VEdlL73Cu.c:26:19: error: expected ';', ',' or ')' before 'a' 26 | int sum( int[][] a, int n ) { | ^
مــــــــســــــعـــود
me
can i msg u on pvt ?
Ekene
I want to know how I can create a website using C. Thanks
Anonymous
?
Ekene
its possible
Do you mean it is possible?
S
Great 👍
TANG DARA
hello guy!
TANG DARA
#include <stdio.h> #include <conio.h> int main(){ char fn,ln,db; int rc; int idc; printf("Enter first name ="); scanf("%s",&fn); printf("Enter last name ="); scanf("%s",&ln); printf("Enter Birthdays ="); scanf("%s",&db); printf("Enter RCert =");scanf("%d",&rc); printf("Enter IDCert =");scanf("%d",&idc); printf("==================================================================================================\n"); printf("%s %s %s %d %d",fn,ln,db,rc,idc); return 0; }
Harshal
Hello please can you send me Notes of c language
Harshal
Plz
Grigoriy
Is it ok to use class, derived from QAbstractItemModel with std::shared_ptr?
Sid Sun
Use gdb
Mohamed Ahmed
What is the website dpaste .org used for
Mohamed Ahmed
'''''''
Only?
I have no idea of other utilities
Herman
hello please how can convert images in matrix using C ?
There is a very simple image format, as simple as csv
Netpbm wiki this
Sid
Why is sizeof called a compile-time operator?
Sid
What is the difference between compile time operator and run time
Sid
Plz explain in details