dipesh
always return 0
I think This is true when we don't have a output or return value.
dipesh
So we use void function if return value is not need or if we just want work to be done like displaying but if we need value or result after calculation we use int function and return value
dipesh
??
Anonymous
cout << "error: " << "bla bla";
Talula
dipesh
Thanks a lot Tazz!!
klimi
you should have asked proper question insted of asking "did anyone use GTK" ofc people did....
Anonymous
Anonymous
@Infolinux 🖖🏻
Hi
@Infolinux 🖖🏻
int main() {
int VarCod, VarTipo,VarX,VarY,VarZ;
float VarPCompra,VarIPI;
printf ("INFORME O VALOR DE COMPRA - R$: ");
scanf ("%f", &VarPCompra);
VarX = 10;
VarIPI = VarPCompra * (VarX/100);
printf("Valor IPI..: %10.2f\n", VarIPI);
}
Result:
INFORME O VALOR DE COMPRA - R$: 5
Valor IPI..: 0.00
@Infolinux 🖖🏻
VarIPI = VarPCompra * (VarX/100);
Why doesn't this work?
@Infolinux 🖖🏻
Any idea?
@Infolinux 🖖🏻
@Infolinux 🖖🏻
I'm going to change the variable type to Float
@Infolinux 🖖🏻
Perfect!
@Infolinux 🖖🏻
Result
@Infolinux 🖖🏻
INFORME O VALOR DE COMPRA - R$: 5
Valor IPI..: 0.50
@Infolinux 🖖🏻
float VarPCompra,VarX,VarIPI;
@Infolinux 🖖🏻
----------
VarX = 10;
VarIPI = VarPCompra * (VarX/100);
printf("Valor IPI..: %10.2f\n", VarIPI);
----------
@Infolinux 🖖🏻
Result:
INFORME O VALOR DE COMPRA - R$: 5
Valor IPI..: 0.50
@Infolinux 🖖🏻
Thanks… 👍🏻👍🏻👍🏻
佳辉
#include <stdio.h>
float add(float , float);
float sub(float , float);
float mult(float , float);
float div(float , float);
float add(float num1, float num2)
{
return num1+num2;
}
float sub(float num1, float num2)
{
return num1-num2;
}
float mult(float num1, float num2)
{
return num1*num2;
}
float div(float num1, float num2)
{
return num1/num2;
}
int main()
{
float num1,num2,result;
char choice;
do
{
printf("1.Addition\n");
printf("2.Subtraction\n");
printf("3.Multiplication\n");
printf("4.Division\n");
printf("5.Exit\n\n");
printf("Enter Your Choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("Enter first number : ");
scanf("%f",&num1);
printf("Enter second number : ");
scanf("%f",&num2);
result = add(num1,num2);
printf("Result:%f",result);
break;
case 2:
printf("Enter first number : ");
scanf("%f",&num1);
printf("Enter second number : ");
scanf("%f",&num2);
result = sub(num1,num2);
printf("Result:%f",result);
break;
case 3:
printf("Enter first number : ");
scanf("%f",&num1);
printf("Enter second number : ");
scanf("%f",&num2);
result = mult(num1,num2);
printf("Result:%f",result);
break;
case 4:
printf("Enter first number : ");
scanf("%f",&num1);
printf("Enter second number : ");
scanf("%f",&num2);
result = div(num1,num2);
printf("Result:%f",result);
break;
case 5:
return 0;
break;
default:
printf("Wrong Choice..!!");
}
printf("\n------------------------------------\n");
}
while(choice<=5);
}
佳辉
this is my coding for simple calculator
佳辉
At the choice there,if a enter a letter,the ouput become weird
佳辉
I wish the output can print out wrong choice when i enter a letter,can someone help me pls😭
Anonymous
@𝑺𝒐𝒃𝒌𝒂
佳辉
佳辉
Anonymous
Hello.everyone
Pleas how we do an array of structure in C
Anonymous
Anonymous
Anonymous
*please
vector at C++ std
佳辉
Anonymous
I want to learn friends
Anonymous
I am a beginner
@𝑺𝒐𝒃𝒌𝒂
佳辉
Anonymous
佳辉
Test it
Now my choice surpose is enter number from 1 to 5,but i hope when i enter a letter,it can print out wrong choice
佳辉
But i have no idea about it
@𝑺𝒐𝒃𝒌𝒂
In choice..
@𝑺𝒐𝒃𝒌𝒂
But i have no idea about it
If you want to use character, you must use something like A for addition, S for Subtraction, and so one.
Then use a sentinel to break the loop.
Sabyasachi
Please see where am I going wrong?
Sabyasachi
It's continuously taking inputs
Владислав🇺🇦
Hello. I am working on a terminal program that (as I imagine it) is intended to handle keyboard input. I wish it to be cross-platform so I decided to use third-party library. I chose OIS(Object oriented Input System), but it needs a window handle to provide keyboard input handling.
So I have two questions:
Is there a way to get that handle of a terminal window via C++ code (and/or X11 but it means I will use platform-specific code either way)?
Maybe I should consider other ways of handling input?
The most obvious ways to resolve this problem I am thinking of are to choose another library (but there are not many of them) or use platform-specific code for each platform.
Any advice is much appreciated!
佳辉
佳辉
Владислав🇺🇦
Golden Age Of
Ok, hi everyone, i need someone's help in one interesting question, really appreciate your help.
Here i have a function which locally inside allocates some memory and creates an object, then it's dereferenced and returned to the list by push_back(), here is the question - do i need to free the memory i allocated in function? I ask it cause when i debug run it, there is called only one destructor of my class and it's list destructor, but in the list i have some quantity of objects. If my function returns Some_Class* , i dereference it and push into the list, do i push there the copy of the object and i've memory leak or i push that object i created in function ?
Sabyasachi
Golden Age Of
Sabyasachi
Yrs
Sabyasachi
It is working fine with two display function. Whenever I am using rotate function it is making problem
Pavel
Golden Age Of
Not me
Anonymous
Anonymous
Anonymous
Anyone know about programming with OpenGL or Magnum C++ Framework?
I need to learn how to move my camera in 3D instead of simply rotating my 3D polygon itself
Specifically instead of a rotating cube, i want to learn how to make a movable camera
Simple movement such as
panning (up down left right)
and zooming (forward, backward)
Will suffice
I am NOT looking for complete code
Sabyasachi
Golden Age Of
also you have variables named *new*, how does it work? what is your IDE and compiler?
Anonymous
Pls tell me the correct one
Instead of just taking two nodes prev and nex, you should take 3 nodes into account like prev, nex and nex_nex
Sabyasachi
Anonymous
Anonymous
Pavel
Anonymous
Eg ITTERATE the list accepting values into each node, until NULL is reached
Sabyasachi