the best for everyone
Okay, simple answer from me, have you tried it ?
#include <stdio.h>
j=1,k=1;
void drow_rect(int length , int width )
length =2;
width =4; to// to minimize the actual size of it
{
/*
for (j=1, j<=width,j++)
{
printf("n\n\");
for(k=1, k<=length,k++)
printf("\ xDB"); // from the hexedecemil
printf("\n");
}
)
*/
for (int i = 0; i < length; i++)
putchar('*');
putchar('\n');
for (int i = 0, n = width - 2, k = length - 2; i < n; i++) {
putchar('*');
for (int j = 0; j < k; j++)
putchar(' ');
puts("*");
}
for (int i = 0; i < length; i++)
putchar('*');
putchar('\n');
)
int main ()
{
printf("\n living room");
drow_rect(22,5);
printf("\n closet\n");
drow_rect(4,5);
printf("\n kitchen\n");
drow_rect(16,5);
printf("\n bedroom\n");
drow_rect(12,12);
}
the best for everyone
the code doesn't work with me
the best for everyone
i couldn't know what is the mistake
the best for everyone
\Device\NUL
#include <stdio.h>
j=1,k=1;
void drow_rect(int length , int width )
length =2;
width =4; to// to minimize the actual size of it
{
/*
for (j=1, j<=width,j++)
{
printf("n\n\");
for(k=1, k<=length,k++)
printf("\ xDB"); // from the hexedecemil
printf("\n");
}
)
*/
for (int i = 0; i < length; i++)
putchar('*');
putchar('\n');
for (int i = 0, n = width - 2, k = length - 2; i < n; i++) {
putchar('*');
for (int j = 0; j < k; j++)
putchar(' ');
puts("*");
}
for (int i = 0; i < length; i++)
putchar('*');
putchar('\n');
)
int main ()
{
printf("\n living room");
drow_rect(22,5);
printf("\n closet\n");
drow_rect(4,5);
printf("\n kitchen\n");
drow_rect(16,5);
printf("\n bedroom\n");
drow_rect(12,12);
}
> j = 1, k = 1;
Did you really understand how to declare variable ?
the best for everyone
Anonymous
Anyone having salesforces test at 6pm ??
RØB
#include<stdio.h>
int main ( )
{
int a[5],i;
printf("enter array ");
for( i=0; i<5; i++ )
{
scanf("%d",&a[i]);
}
for(i=0; i<5; i++)
{
printf("%d",&a[i]);
}
return 0;
}
Y i m nt getting correct output?
\Device\NUL
Anonymous
Welcome all
ayush....
/*
Q. MAKE A PROGRAM WHICH CONVERT DIFFENT UNIT IN GIVEN UNIT BY TAKING INPUT FROM USER
km to miles
cms to inch
pound to kgs
inches to meters
convert foot to inch
*/
#include <stdio.h>
int main()
{
char distance;
float c, k, m, i, p, f, g;
printf("enter\nk for kilometer to miles\nc for cms to inches\np for pound to kgs\ni for inche to meters\nf for foot
scanf("%c", distance);
switch (distance)
{
case 'k':
printf("enter distance in km ");
scanf("%f", &k);
m = 1.609 * k;
printf("\ndistance mile is %f\n", m);
break;
case 'c':
printf("enter ditance in cms ");
scanf("f", &c);
i = 2.54 * c;
printf("\ndistance inche is %f\n", i);
break;
case 'p':
printf("enter weight in pound ");
scanf("f", &p);
g = 2.2 * p;
printf("\nweight in k is %f\n", g);
break;
case 'i':
printf("enter ditance in inches ");
scanf("f", &i);
m = 39.37 * i;
printf("\ndistance meter is %f\n", m);
break;
case 'f':
printf("enter ditance in foot ");
scanf("f", &f);
i = 0.0833 * f;
printf("\ndistance inche is %f\n", i);
break;
defualt:
printf("please choose correct option");
break;
}
return 0;
}
ayush....
/*
Q. MAKE A PROGRAM WHICH CONVERT DIFFENT UNIT IN GIVEN UNIT BY TAKING INPUT FROM USER
km to miles
cms to inch
pound to kgs
inches to meters
convert foot to inch
*/
#include <stdio.h>
int main()
{
char distance;
float c, k, m, i, p, f, g;
printf("enter\nk for kilometer to miles\nc for cms to inches\np for pound to kgs\ni for inche to meters\nf for foot
scanf("%c", distance);
switch (distance)
{
case 'k':
printf("enter distance in km ");
scanf("%f", &k);
m = 1.609 * k;
printf("\ndistance mile is %f\n", m);
break;
case 'c':
printf("enter ditance in cms ");
scanf("f", &c);
i = 2.54 * c;
printf("\ndistance inche is %f\n", i);
break;
case 'p':
printf("enter weight in pound ");
scanf("f", &p);
g = 2.2 * p;
printf("\nweight in k is %f\n", g);
break;
case 'i':
printf("enter ditance in inches ");
scanf("f", &i);
m = 39.37 * i;
printf("\ndistance meter is %f\n", m);
break;
case 'f':
printf("enter ditance in foot ");
scanf("f", &f);
i = 0.0833 * f;
printf("\ndistance inche is %f\n", i);
break;
defualt:
printf("please choose correct option");
break;
}
return 0;
}
WHAT wrong in this??
James
Why
klimi
why not just ask your question?
.
Can any one send me a reference book for C++ to teach my self with out a teacher
Melbgm
guys why is my code not working do you have any idea
Melbgm
int Find__from tel_number(tel_num[])
{
char ch, *number;
TelDef person;
fflush(stdin);
printf("Found person\nnumber: ");
gets(person.tel_num);
number = find number(person.tel_num);
if (number)
printf("\nNumber: %s\n", number);
else
printf("\nContact not found!\n");
}
find int number(char tel_num[], name[])
{
TelDef* node = _start;
while (dump) {
if (!strcmp(tel_num, dugum->tel_num))
return node->name;
my node = my node->next;
}
return NULL;
}
klimi
well.... it's just o comment of code...
Melbgm
edited
klimi
Anonymous
Hades
best way to learn c++ faster
Hades
I want to, but couldn't follow any resource
Hades
any recommendations?
klimi
you can also watch youtube videos or follow some course
Hades
if I know something about programming, can I use just the reference material like Bjarne's C++ Programming Language
klimi
yeah, surely that is an option
Hades
Hades
but thanks for the help! =)
yasmine
https://chat.whatsapp.com/IlDxbbaEo6qGHhksBrK6Q9
Melbgm
I use Arch
Hi there!
Does anyone know how to find a difference between two strings like with git diff?
For example
str1: "parameter is {8, ba} btw"
str2: "parameter is {22, h} btw"
And I want to find out differences ("8" to "22" and "ba" to "h") starting and ending indexes
I can neither find something already created nor come up with optimized enough algorithm.
Lengashe
write a program to calculate the average of five numbers entered by the user in main (). and the function average that computees the average and display it.
Lengashe
I use Arch
I use Arch
Or you need arithmetical mean?
Lengashe
I use Arch
yes arithmeticcal
Then it is even simpler. Just create a variable with sum of inputed numbers, then divide it by 5 and output 🤨
Anonymous
Yeah its so straight forward program
Lengashe
thank you
coal
coal
it would be the most straightforward way
coal
it would give you an array of booleans (0, 1), and for every different character, their index in the array would equal to 1
coal
then you have a more complicated problem
coal
the first solution i can think of
coal
would be setting delimiters such as spaces, and segmenting the string in pairs of characters for every space-separated word
coal
then iterate the other string looking for these delimiters and pairs
coal
everytime it doesnt match, continue iterating while marking these characters as different, until you find the next delimiter and pair
coal
iirc git diff uses symbols and spaces as delimiters
Ali mohammadi
hi guys i need help
can i convert c++ code that i write in visual studio in x86 platform to android app?
Ron
Test
klimi
I use Arch
klimi
what do you mean "app of it" ?
Anonymous
Guys can anyone share a link or source code to get some concept and idea based on the image solving game in c++
Anonymous
All I found is this but it’s done in c# https://youtu.be/cVe7sGmkBLo
the best for everyone
// store midterm and final exam grades in
// a 2 dimensional array and calculate class average in c language
#include<stdio.h>
// #difne n 5 ; #difne m 7
#include <stdio.h>
#include <stdlib.h>
void calculate(int students[4][5])
{
int sum=0;
int average=0;
int i,j; // conuntares
int max;
int maxID;
for (i = 0; i < 4; i++) // for column
{
sum=0; // to be able to sum each row of them
for (j = 1; j <4; j++) // for row
{
sum=sum+students[i][j];
}
average=sum/(j-1); // why ??
students[i][j]=average;
}
max=students[0][4];
maxID=0;
for (i = 0,j=4; i < 3; i++)
{
if(max<students[i+1][j]){
max=students[i+1][j];
maxID=i+1;
}
}
printf("the highest average is : %d with student id : %d",max,maxID+1);
}
int main()
{
int students[4][5]={1,67,76,55,0},{2,34,79,76,0},{3,56,68,57,0},{4,66,89,65,0};
calculate(students);
return 0;
}
the best for everyone
what is the problem in this code
Mahin
Hi
Prince Fine
🤧 please stop
Roxifλsz 🇱🇹
tfw 6 millionth investing ad
Roxifλsz 🇱🇹
CALVIN
If it possible to take the returned value of one function and initialize it to another variable in another function.....
For example...
..............................................
Function1
{
return sum;
}
Function2
{
TOTAL = {Function1} ;
}
..................................
Please help if the is a proper may of doing it....
the best for everyone
can anyone tells me about what is the mistake here ?
kj
kj
nothing is wrong
aishu
Can we use for loop inside if condition statement?
If yes, can you give me an example?
shriman_deepak
the best for everyone
aishu
the best for everyone
// sorting and swapping a number in Array
#include<stdio.h>
int main ()
{
int a[100], n; // n comes in the end of the Array
printf("Enter a number that you want ");
scanf("%d",&n);
for(int i=0; i<n ; i++) // to pass whole the numbers
scanf("%d",&a[i]);
for(int i=0 ; i<n;i++) // column
{
for (j=0;j<n;j++) // row
{
if(a[i]>a[j]) // if its bigger it will enter and will continue
int temp = a[i];
a[i]=a[j];
a[j]= temp ; // you can say its the Algorathams of changing
}
}
}
the best for everyone
can anyone tells me about what is the mistake here ?