Unknown
I need help with structure,
I used structure for character and then I make it in function but the problem is it doesn’t take the character with spaces,
When I use the fgets the code doesn’t allowed me to write anything
Unknown
#include <stdio.h>
struct work
{
char work_name[100];
};
struct work work_infos();
int main()
{
struct work work_infos();
}
struct work work_infos()
{
struct work s1;
printf("Enter the work: ");
//fgets(s1.work_name, 100, stdin);
return s1;
}
J
J
Are you using a for loop? (For iterating variables? Since it is C++, you can also use cout)
Anonymous
U can't << a vector
S__R
use for() { code } you cout is not in inside your for loop statement and use the index in buffer also
Anonymous
Try replace it with
for (const auto &i : buffer)
cout << i << " ";
cout << endl;
Bobur
J
Replace i with std::bitset<8>(i)
Unknown
How can I get the sum off numbers in array
Nitin
Nitin
sum+=a[i];
Unknown
I tried it but it doesn’t work I think because I use also structure with it
Unknown
void summary(struct work work_array[], int num_of_work)
{
int average;
int i;
int sum;
for (i = 0; i < num_of_work; i++)
{
printf("%d. Work Number %d: \t ", i + 1, i + 1);
printf("work name is %s \t", work_array[i].work_name);
printf("\t ");
printf("work percentage is %d: \t ", work_array[i].work_percentage);
printf("\n");
//sum += work_array[i].task_percentage;
}
//average = sum / num_of_work;
printf("\nThe number of works are: %d \n", num_of_work);
//printf("The average comption percentage for all: %d \n", average);
}
Unknown
I use Arch
Unknown
Anonymous
C++ is really stressful but interesting tho
Anonymous
I've been struggling with loops for some days now😩
Mandelbröt
Anyone have a code in c++ for implementation of a* search algorithm for a finding a goal node in graph ?
A.M UMAR
Hi am new here need help
A.M UMAR
1. Define a class License that has a driving license number, name and address.
2. Define constructors that take on parameter that is just the number and another where all
parameters are present
A.M UMAR
Thanks 🙏
klimi
*sigh* it is so hard to do assignments you are supposed to solve yourself isn't it
Hasan
Hi
Hasan
How do I add the words in the Txt file to the array in C?
Luca
Hasan
Hasan
I'll add and remove as many words as I want.
Luca
Ok so you need to dynamic allocate an array, because the number of line is unknowed.
The workflow should be:
1.) Reading file the first time to get the number of rows
2.) allocating a matrix of char depending by the number of lines
3.) reading the file a second time and storing each line inside the matrix
Hasan
Raheeel 🧗♂️🪂
Void loop()
{
Val = digitalRead(inputPin);
If (Val == HIGH)
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite (ledPin, LOW);
}
}
----------------------------------------------
What I want to do
If Val == high for 5min then digitalWrite (ledPin, high)
Anonymous
use chrono.h for accessing time
moni
Please how code is working ? Please help
Sñeha
Anyone who knows devops ?
Unknown
I want to be allowed to write character with spaces with this
Unknown
#include <stdio.h>
typedef struct
{
char work_name[100];
}work;
work work_info();
int main()
{
int num_of_work;
printf("Please Enter how many works you want to manage: ");
scanf("%d", &num_of_work);
work work_array[num_of_work];
for (int i = 0; i < num_of_work; i++)
{
work_array[i] = work_info();
printf("Work Number: %d \n", i + 1);
printf("Work Name: %s \n", work_array[i].work_name);
printf("\n");
}
}
work work_info()
{
work info;
printf("Enter the work's name: ");
scanf("%s", info.work_name);
return info;
}
\Device\NUL
Unknown
Unknown
#include <stdio.h>
typedef struct
{
char work_name[100];
}work;
work work_info();
int main()
{
int num_of_work;
printf("Please Enter how many works you want to manage: ");
scanf("%d", &num_of_work);
work work_array[num_of_work];
for (int i = 0; i < num_of_work; i++)
{
work_array[i] = work_info();
printf("Work Number: %d \n", i + 1);
printf("Work Name: %s \n", work_array[i].work_name);
printf("\n");
}
}
work work_info()
{
work info;
printf("Enter the work's name: ");
scanf("%s", info.work_name);
// scanf("%[^\n]%*c", info.work_name);
// scanf("%[^\n]s", info.work_name);
return info;
}
\Device\NUL
\Device\NUL
Have you changed it ?
Unknown
Yes I tried and then I make it as a comment
\Device\NUL
Unknown
Yes 👍
\Device\NUL
Okay sorry
Unknown
absolutely correct,
Unknown
Unknown
Anyways thank you,
\Device\NUL
Ah sorry
\Device\NUL
\Device\NUL
Try to put getchar() after first scanf and in the function
\Device\NUL
That's why it didn't work
\Device\NUL
#include <stdio.h>
typedef struct work
{
char work_name[100];
};
work work_info();
int main()
{
int num_of_work;
printf("Please Enter how many works you want to manage: ");
scanf("%d", &num_of_work);
getchar(); //ignore newline
work work_array[num_of_work]; //Vulnerable to stack overflow i think
for (int i = 0; i < num_of_work; i++)
{
work_array[i] = work_info();
printf("Work Number: %d \n", i + 1);
printf("Work Name: %s \n", work_array[i].work_name);
putchar('\n');
}
}
work work_info()
{
work info;
printf("Enter the work's name: ");
scanf("%99[^\n]", info.work_name);
getchar(); //Ignore newline
return info;
}
Kσϝɾα
Hello, does anyone here knows a c library to draw chronograms?
Unknown
Anonymous
#question
Why is this code creating thread continuously in a loop?
boost::asio::io_context io_context;
tcp::acceptor a(io_context, tcp::endpoint(tcp::v4(), port));
for (;;) {
std::thread(
&ReportSession::start, ReportSession(a.accept(), authManager, credentialsParser, taxtServiceFactory))
.detach();
}
olli
Raheeel 🧗♂️🪂
https://pastebin.com/1SvQjHw9
Raheeel 🧗♂️🪂
error
klimi
Unknown @DangerNetwork:
⸮sd�$ܟ<�⸮l⸮< ⸮ l⸮ c|⸮⸮ ⸮ ⸮r⸮#⸮ c⸮⸮go⸮dog⸮⸮⸮ c pćdsdrlp⸮g⸮ ⸮ l Ĝ c n⸮| $⸮ ⸮c⸮⸮g'⸮�l⸮⸮d` ⸮ 'o d` gs⸮ۓo # ⸮ $ ;⸮⸮g c ⸮ l⸮c;c ⸮⸮㌛` ⸮⸮'⸮
connecting to Node
........................
WiFi connected
IP address:
192.168.48.140
connecting to maker.ifttt.com
connection failed
Raheeel 🧗♂️🪂
connecting to Node
........................
WiFi connected
IP address: 19216743180
connecting to maker
connection failed
Abdelrhman
Write a c ++ program that read the grade of student:
If grade greater than 85 student get A
- If grade greater than 75 student get B
- If grade greater than 65 student get c
If grade less than 50 student fail
Repeat it until user enter (- 1) to end. Print out
1. The no of students passes and no of students failure
2. The no of students get score A
3. The no of students get score B
4. If the percentage of student passes is greater than 60%, print out "added bonus", then print the list of students (name, ID and grade) after and before bounce.
Then print again the new number of passes students. Note: new grade -old grade +5.
Abdelrhman
I need help
Raheeel 🧗♂️🪂
Help
https://pastebin.com/1SvQjHw9
error
connecting to Node
........................
WiFi connected
IP address: 19216743180
connecting to maker
connection failed
Dinesh
Product of integers
Dinesh
Question send guys
Pavel
Hey you guys, glad to join your community!
I have a question, if you don’t mind
Pavel
#include <string>
int f(int i); // forward declaration
int main()
{
const double pi = 3.14; //OK
int i = f(2); //OK. f is forward-declared
std::string str; // OK std::string is declared in <string> header
C obj; // error! C not yet declared.
j = 0; // error! No type specified.
auto k = 0; // OK. type inferred as int by compiler.
}
int f(int i)
{
return i + 42;
}
Why does c++ needs a function declaration? I’m working as a C# developer, so it is pretty uncommon to me. Why does compiler needs function declaration, if it can take it from definition?
Samir
Hi.
Can anyone help me to make a program to write words letter by Letter and make sounds.?
Hsn
is it that hard ?
Hsn
just check online for 3-4 key press sounds .. and look for online code that plays it .. write a function that runs one randomly .. and 80% of your project is done already ?
Samir
I just scramble the code order
Samir
Plz help
Morax
Why return 0 signifies successful termination whereas anything other than zero unsuccessful termination?
Asking in reference to the general terminology that 0 is false and non zero is true?
Morax
Is there any logic or they just went ahead with it?