Leonardo
for this reason we should code in binary
Leonardo
(im joking)
Leonardo
anyway ill have a c exam in January😳🫣
Shaheer
.Write a program that inputs no of persons and their ages
respectively. It then counts the no. of persons in age group
50 to 60.
Please in c++
DaviChan
DaviChan
『TY』ϻʳησ𝐁Ⓞ𝕕Ƴ 657
『TY』ϻʳησ𝐁Ⓞ𝕕Ƴ 657
helllooo
touhou
helllooo
https://t.me/programminginc/481019
Leonardo
DaviChan
helllooo
Hello! I answered you already
DaviChan
DaviChan
『TY』ϻʳησ𝐁Ⓞ𝕕Ƴ 657
sorry
『TY』ϻʳησ𝐁Ⓞ𝕕Ƴ 657
yes
DaviChan
Okay, did it work? 🤔
Muhamad Khalid Muzappa
Anybody here developing C project under windows using mingw? I cant get dup(int fd1, int fd2) function to work under windows. It compiles without error, but dup2 just wont work. Anybody here having same problem?
『TY』ϻʳησ𝐁Ⓞ𝕕Ƴ 657
Vlad
Vlad
gotcha covered
『TY』ϻʳησ𝐁Ⓞ𝕕Ƴ 657
all comma went gone
Muhamad Khalid Muzappa
_dup2
Thankyou sir. Will try. Does _dup2 works on MingW or i need to compile my code using Microsoft visual c++?
Vlad
Vlad
Should work
『TY』ϻʳησ𝐁Ⓞ𝕕Ƴ 657
i cannot send image
『TY』ϻʳησ𝐁Ⓞ𝕕Ƴ 657
Yes you can ^^
replace "%d," with i<n?"%d,":"%d"
#include <stdio.h>
void main()
{
int arr[100];
int i,n;
printf("\n\nEnter Size:");
scanf("%d",&n);
for(i=1; i<=n; i++)
{
printf("Enter element %d : ",i);
scanf("%d", &arr[i]);
}
printf("[");
for(i=1; i<n; i++)
{
printf("%d", arr[i]);
}
printf("]");
}
DaviChan
Uhm
DaviChan
the whole line shhould be:
printf(i<n?"%d,":"%d", arr[i]);
DaviChan
look up the "ternary operator" on cppreference for reference :)
DaviChan
This ofc. Is not the most "runtime efficient" way, but i quite like doing it that way
Baby
Hi, if i want to add a enum to a class. where do i declare it? I declare it within the class but it cant be accessed
Baby
i couldnt find examples on google. and also i am doing cpp on netbeans. the code is showing build errors
Olivia
#include <iostream>
using namespace std;
int main() {
int number=6;
// left arrow
for (int i=0; i <= number; i++)
{
for (int j=0; j < number; j++)
{
if (i== number/2 i-j == number/2 i+j == number/2)
cout <<"*";
else
cout <<" ";
}
cout << endl;
}
return 0;
}
Please explain this how its work
Warlock
Gregory
Olivia
Olivia
Anonymous
#include <stdio.h>
void main() {
float weight, height, bodyWeightIndex;
weight =80;
height =1.5;
printf("%d", 'weight\n');
scanf("%f", '&weight\n');
printf("hieght\n");
scanf("%f", '&height\n');
bodyWeightIndex=weight/(height*height);
printf("Your body weight is%.2f\n",bodyWeightIndex);
if (bodyWeightIndex>=25.0)
printf("Your body weight is more than ideal weight.\n Try reducing\n" );
else
printf("Congratulations! Your body weight is normal\n");
return 0;
}
Anonymous
P
can anyone help me to solve it please
P
actually i am not able to go for the case <8
Anonymous
Anonymous
Chyo takoy
Can you speak English i dont understand you sorry
Anonymous
Pavel
Anonymous
can anyone help me to solve it please
Anonymous
#include<iostream>
using namespace std;
const char STAR = *;const int PRIME = 7;
void main;{int count, sum, x;count = 1;
sum – count + PRIMEx = 25.67;
newNum = count * ONE +2;sum + count = sum;
x = x + sum * COUNT;
cout <<”count =”<< count<< “; sum = “ << sum << “,PRIME=” << prime;
Anonymous
Anonymous
Anonymous
Anupam2.7
question is to find the number of trailing zero of the factorial of the given number.
sample input: 5, output: 1
I have written it's program in c++, it is working fine for small number, but in cause of input 100 it outputs 0.
So, in these type of questions do I have to worry about large inputs?
how can i fix this?
the program: https://onlinegdb.com/PSW0JawAa
Pavel
Faramarz
Can someone help me to understand the condition of this for loop please?
How i < s[i] != '\0' works?
void strToLower(char s[])
{
for(int i=0; i<s[i] != '\0'; i++)
s[i] = tolower(s[i]);
}
Egro
guys
Egro
so i finally, comprehend, call by reference .... took me two days
Iwan
Language:
c
Code:
#include <stdio.h>
#include <ctype.h>
int main()
{
char s[]="AbcDeFGijkL";
for (int i=0;i<s[i] !='\0';i++) s[i]=tolower(s[i]);
printf("%s",s);
}
Output:
abcdefgijkl
Iwan
Iwan
Baby
Hii, uhh i have a very dumb question. can anyone please help? 😅😅
suppose a virtual class called User has two child classes "Teacher" and "Student" ;
can Teacher class take in Students as a parameter of one of its function? 😅
Student has a function called
void printDetails();
it returns cout all of student details.
i want teacher to view student details too.
void viewStudentDetails(Student *s){
s->printDetails();
}
Faramarz
Anonymous
Konstantin
almost all about classes, constructor, destructor, Python-style "this", Declaration and implementation..
Peter
guys, suppose I have a C program in C named my_program,
echo "some text" | my_program
how do I handle the piped input in my program... I've tried googling, but failed
Anupam2.7
Anupam2.7