🙋🏻♂️
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?
Stanislav
zakaria
hey, I need some quick tutorials in oop c++, and some practice exercises can someone help? thanks in advance
Stanislav
𝕶𝖎𝖔𝖏𝖊𝖊𝖓 ⁞𒄩𒊓𒉡
Stanislav
𝕶𝖎𝖔𝖏𝖊𝖊𝖓 ⁞𒄩𒊓𒉡
qt-vsaddin-msvc2022-2.8.0.vsix
𝕶𝖎𝖔𝖏𝖊𝖊𝖓 ⁞𒄩𒊓𒉡
Stanislav
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
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
%Nikita
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
Anonymous
LeBouy
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
Anonymous
%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
me
مــــــــســــــعـــود
&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 ?
مــــــــســــــعـــود
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); } }
See this function and use it.
Example : sum(data, 0, 3, 0, 4)
For 3 and 4 length
Ekene
I want to know how I can create a website using C.
Thanks
Anonymous
Anonymous
?
\Device\NUL
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
Tushar
Grigoriy
Is it ok to use class, derived from QAbstractItemModel with std::shared_ptr?
Prince Of Persia
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); } }
Such a neat code bro😂
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
Herman
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