I just wrote a code for myself to clear certain things......... ..
When i made this program to execute in turbo c++ it didnt.....
it showed following error.
I have pasted the output after code is over.
But when i executed the same code in microsoft visual c++; it worked without showing any errors.
Can somebody tell me why that happened.
[code=c]
#include<stdio. h>
#include<conio. h>
void assign();
void check();
float c;
void main()
{
int choise;
do{
printf("\nEnter your choise from the given menu:\n 1.Assign\n 2.Check \n 3.Exit\n");
scanf("\n%d",&c hoise);
switch(choise)
{
case 1:
assign();
break;
case 2:
check();
break;
case 3:
break;
}
}while(choise!= 3);
}
void check()
{
float i;
printf("%f",&c) ;
i=c+1;
printf("\n%f",i );
printf("\n%f",& i);
}
void assign()
{
printf("\n Enter the value of c:\n");
scanf("\n%f",&c );
}
[/code]
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
1
Enter the value of c:
2
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
2
Floating point error: Domain.
Abnormal program termination
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
2
Floating point error: Domain.
Abnormal program termination
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
1
Enter the value of c:
33.4
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
2
Floating point error: Domain.
Abnormal program termination
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
When i made this program to execute in turbo c++ it didnt.....
it showed following error.
I have pasted the output after code is over.
But when i executed the same code in microsoft visual c++; it worked without showing any errors.
Can somebody tell me why that happened.
[code=c]
#include<stdio. h>
#include<conio. h>
void assign();
void check();
float c;
void main()
{
int choise;
do{
printf("\nEnter your choise from the given menu:\n 1.Assign\n 2.Check \n 3.Exit\n");
scanf("\n%d",&c hoise);
switch(choise)
{
case 1:
assign();
break;
case 2:
check();
break;
case 3:
break;
}
}while(choise!= 3);
}
void check()
{
float i;
printf("%f",&c) ;
i=c+1;
printf("\n%f",i );
printf("\n%f",& i);
}
void assign()
{
printf("\n Enter the value of c:\n");
scanf("\n%f",&c );
}
[/code]
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
1
Enter the value of c:
2
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
2
Floating point error: Domain.
Abnormal program termination
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
2
Floating point error: Domain.
Abnormal program termination
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
1
Enter the value of c:
33.4
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
2
Floating point error: Domain.
Abnormal program termination
Enter your choise from the given menu:
1.Assign
2.Check
3.Exit
Comment