#include%26lt;stdio.h%26gt;
int fnGetResult(int *piValue)
{
int iRet = *piValue * 2;
*piValue = iRet * 3;
return iRet;
}
int main(int argc, char **argv)
{
int iNum = 10, iRes;
iRes = fnGetResult(%26amp;iNum);
printf("%d %d",iNum, iRes);
return 0;
}
C language: Watz the output of this????????????
60 20
Reply:60 20
Monday, May 24, 2010
C++ language problems?
what means by the numbers 72,77,75,80 from conway's game of life block codes illustrate below, isn't a arrow keys.
{
case 0:k0=getch();
switch(k0)
{
case 72:
if(y%26gt;1)
y--;
break;
case 80:
if(y%26lt;24)y++;
break;
case 75:
if(x%26gt;1)x--;
break;
case 77:
if(x%26lt;80)x++;
break;
}
i will gave 10pts if someone has effort to explain this
C++ language problems?
Complete list of keyscan codes for your reference, click the link below
https://www.glue.umd.edu/~nsw/ench250/sc...
We are using C++ getch() method from the iostream library to scan the key being pressed. You can also refer MSDN library for help on getch() method if you are using Visual Studio. Just select getch and press F1.
Good day bye
Reply:They're the arrow keys on the *numeric* keypad and with caps lock turned off. Pressing those keys returns two keys from getch(): a 0 followed by either 72 (up), 75 (left), 77 (right) or 80 (down).
The other arrow keys on the keyboard return -32 followed by the same extended codes.
{
case 0:k0=getch();
switch(k0)
{
case 72:
if(y%26gt;1)
y--;
break;
case 80:
if(y%26lt;24)y++;
break;
case 75:
if(x%26gt;1)x--;
break;
case 77:
if(x%26lt;80)x++;
break;
}
i will gave 10pts if someone has effort to explain this
C++ language problems?
Complete list of keyscan codes for your reference, click the link below
https://www.glue.umd.edu/~nsw/ench250/sc...
We are using C++ getch() method from the iostream library to scan the key being pressed. You can also refer MSDN library for help on getch() method if you are using Visual Studio. Just select getch and press F1.
Good day bye
Reply:They're the arrow keys on the *numeric* keypad and with caps lock turned off. Pressing those keys returns two keys from getch(): a 0 followed by either 72 (up), 75 (left), 77 (right) or 80 (down).
The other arrow keys on the keyboard return -32 followed by the same extended codes.
I want c program in c language lcd gcd with recursive function?
This example illustrates recursive calls:
int factorial( int num ); /* Function prototype */
int main()
{
int result, number;
.
.
.
result = factorial( number );
}
int factorial( int num ) /* Function definition */
{
.
.
.
if ( ( num %26gt; 0 ) || ( num %26lt;= 10 ) )
return( num * factorial( num - 1 ) );
}
sorry cant find any program of that sort , and to write one i may well take more than one hour.
good luck :)
pokemon cards
int factorial( int num ); /* Function prototype */
int main()
{
int result, number;
.
.
.
result = factorial( number );
}
int factorial( int num ) /* Function definition */
{
.
.
.
if ( ( num %26gt; 0 ) || ( num %26lt;= 10 ) )
return( num * factorial( num - 1 ) );
}
sorry cant find any program of that sort , and to write one i may well take more than one hour.
good luck :)
pokemon cards
What is main diffrence between 'c' language and ' c++ ' why we use c++ is any logic why we indicate '++ '
For the most part, you can say that C is a subset of C++, meaning that most of the facets of C are also legal in C++.
As others have said, C++ is an object-oriented language, as C is an imperative language. An imperative language is a language built for "top-down" programming. For example, in football, a play is called, the quarterback may audible, the ball is snapped... Step-by-step statements.
In an object-oriented language, you build things in terms of objects. Classes are the blueprints for these objects. An object can be anything, you can have a footballTeam object, a quarterback object.. So you can say, "the quarterback" calls an audible, stressing that "the quarterback" class will provide an action in your program. So, you think in terms of objects when writing code.
What is main diffrence between 'c' language and ' c++ ' why we use c++ is any logic why we indicate '++ '
C has been around for a long time, the 70s/80s. Moving up to the next level of C is shown by incrementing to the "next" level. In both C and C++, incrementing to the next integral value is accomplished by the ++ operator..
So the name wizards decided that to incrementing the C language to the next level would be would easily understood by C programmers if were called C++. Believe it or not, a very early language was A, followed by B and then C.... So instead of going to D, they went to C++...
I am in the embedded world, and C is still the predominate language used there. C++ comes with way too much overhead.
But in the application world, PC and web stuff, C++ has become the language of choice, due to the object oriented nature of itl....
Reply:The main difference between 'C' and 'C++' is that 'C' is a procedural programming language while 'C++' is mainly used for OOP (Object-Oriented Programming).
++ in 'C++' means 'C plus class'
Reply:C++ is a superset of C. There are additional features in it, and it supports object-oriented programming. '++' is a unary operator in C and means to increment. Which is why it has a double meaning in C++.
As others have said, C++ is an object-oriented language, as C is an imperative language. An imperative language is a language built for "top-down" programming. For example, in football, a play is called, the quarterback may audible, the ball is snapped... Step-by-step statements.
In an object-oriented language, you build things in terms of objects. Classes are the blueprints for these objects. An object can be anything, you can have a footballTeam object, a quarterback object.. So you can say, "the quarterback" calls an audible, stressing that "the quarterback" class will provide an action in your program. So, you think in terms of objects when writing code.
What is main diffrence between 'c' language and ' c++ ' why we use c++ is any logic why we indicate '++ '
C has been around for a long time, the 70s/80s. Moving up to the next level of C is shown by incrementing to the "next" level. In both C and C++, incrementing to the next integral value is accomplished by the ++ operator..
So the name wizards decided that to incrementing the C language to the next level would be would easily understood by C programmers if were called C++. Believe it or not, a very early language was A, followed by B and then C.... So instead of going to D, they went to C++...
I am in the embedded world, and C is still the predominate language used there. C++ comes with way too much overhead.
But in the application world, PC and web stuff, C++ has become the language of choice, due to the object oriented nature of itl....
Reply:The main difference between 'C' and 'C++' is that 'C' is a procedural programming language while 'C++' is mainly used for OOP (Object-Oriented Programming).
++ in 'C++' means 'C plus class'
Reply:C++ is a superset of C. There are additional features in it, and it supports object-oriented programming. '++' is a unary operator in C and means to increment. Which is why it has a double meaning in C++.
I want c program in c language lcd gcd with recursive function?
To Calculate the GCD of two numbers recursively, you can use
1) Euclid's Algorithm:
int gcd(int m, int n) {
if ((m % n) == 0)
return n;
else
return gcd(n, m % n);
}
OR
2) Dijkstra's Algorithm
int gcd(int m, int n) {
if(m == n)
return m;
else if (m %26gt; n)
return gcd(m-n, n);
else
return gcd(m, n-m);
}
OR
3) BRUTE force guessing
int tryDivisor(int m, int n, int g) {
if (((m % g) == 0) %26amp;%26amp; ((n % g) == 0))
return g;
else
return tryDivisor(m, n, g - 1);
}
In this last one, g is a guess. If the guess works, then it returns the guess. Otherwise, it tries a smaller guess.
I want c program in c language lcd gcd with recursive function?
This might help you with your homework:
http://www.google.co.uk/search?hl=en%26amp;q=l...
Rawlyn.
1) Euclid's Algorithm:
int gcd(int m, int n) {
if ((m % n) == 0)
return n;
else
return gcd(n, m % n);
}
OR
2) Dijkstra's Algorithm
int gcd(int m, int n) {
if(m == n)
return m;
else if (m %26gt; n)
return gcd(m-n, n);
else
return gcd(m, n-m);
}
OR
3) BRUTE force guessing
int tryDivisor(int m, int n, int g) {
if (((m % g) == 0) %26amp;%26amp; ((n % g) == 0))
return g;
else
return tryDivisor(m, n, g - 1);
}
In this last one, g is a guess. If the guess works, then it returns the guess. Otherwise, it tries a smaller guess.
I want c program in c language lcd gcd with recursive function?
This might help you with your homework:
http://www.google.co.uk/search?hl=en%26amp;q=l...
Rawlyn.
Is C language is useful in economics?
C-language is useful for programming in computer not economics.
Is C language is useful in economics?
According to me C language is not at all useful in ECONOMICS.
ANYWAYS there are options for each and everything to happen in todays world and a result it could be useful in the future but not at all in present in ECONOMICS.
Reply:At present, C language is not useful in economics.
In future, it will useful in economics also.
But, we know abt that. Its useful for us.
Reply:IF THERE is some calculations then for it c language is very useful
Reply:Economics and Language C has nothing do with each other.
C language is a Computer Programming language where software developers are interested in IT field.
Economics is the branch of social science that deals with the production and distribution and consumption of goods and services and their management.
Basic in computers like Windows, Ms Office and Internet is fine in the field of Economics.
Reply:C language isn't useful in economics..
Is C language is useful in economics?
According to me C language is not at all useful in ECONOMICS.
ANYWAYS there are options for each and everything to happen in todays world and a result it could be useful in the future but not at all in present in ECONOMICS.
Reply:At present, C language is not useful in economics.
In future, it will useful in economics also.
But, we know abt that. Its useful for us.
Reply:IF THERE is some calculations then for it c language is very useful
Reply:Economics and Language C has nothing do with each other.
C language is a Computer Programming language where software developers are interested in IT field.
Economics is the branch of social science that deals with the production and distribution and consumption of goods and services and their management.
Basic in computers like Windows, Ms Office and Internet is fine in the field of Economics.
Reply:C language isn't useful in economics..
Free c language website?
could u please
Free c language website?
Open Source Compier:
http://www.bloodshed.net/devcpp.html
Free codes,ideas,algorithms and Utilites:
http://www.imada.sdu.dk/~svalle/courses/...
http://www.planet-source-code.com/
http://www.programmersheaven.com/
http://www.programmingtutorials.com/
http://www.thefreecountry.com/sourcecode...
plum
Free c language website?
Open Source Compier:
http://www.bloodshed.net/devcpp.html
Free codes,ideas,algorithms and Utilites:
http://www.imada.sdu.dk/~svalle/courses/...
http://www.planet-source-code.com/
http://www.programmersheaven.com/
http://www.programmingtutorials.com/
http://www.thefreecountry.com/sourcecode...
plum
In C language , how can a string be printed to the console , with an empty main body ?? Impossible ??
Right now I can't come up with a way to do it in C.
In C++ you can do this:
class X
{
public:
X()
{
printf("Hello World!\n");
}
};
X x;
void main()
{
}
The constructor for x gets called before main is run.
I just tested this using VC6.0, and it works.
In C language , how can a string be printed to the console , with an empty main body ?? Impossible ??
It's been a long time since I've worked with C, but I believe that if you clear the screen then use the method
cout %26lt;%26lt; "String"
That'll do it... If that doesn't work, try changing the direction of the pointer.
Reply:You can use #error, but that will print a message at compile time. Some compilers also allow you to display a message via #pragma, but again, that's at compile time.
You can do something like this:
#include %26lt;stdio.h%26gt;
#define OBRACKET {printf("Hello world\n");
#define CBRACKET }
main()
OBRACKET
CBRACKET
Another option is use my example above, but substitute atexit(foo); for printf(), then declare function foo as such:
void foo()
{
printf("Test\n");
}
There might also be a way to do it in C++, but I'm not sure.
In C++ you can do this:
class X
{
public:
X()
{
printf("Hello World!\n");
}
};
X x;
void main()
{
}
The constructor for x gets called before main is run.
I just tested this using VC6.0, and it works.
In C language , how can a string be printed to the console , with an empty main body ?? Impossible ??
It's been a long time since I've worked with C, but I believe that if you clear the screen then use the method
cout %26lt;%26lt; "String"
That'll do it... If that doesn't work, try changing the direction of the pointer.
Reply:You can use #error, but that will print a message at compile time. Some compilers also allow you to display a message via #pragma, but again, that's at compile time.
You can do something like this:
#include %26lt;stdio.h%26gt;
#define OBRACKET {printf("Hello world\n");
#define CBRACKET }
main()
OBRACKET
CBRACKET
Another option is use my example above, but substitute atexit(foo); for printf(), then declare function foo as such:
void foo()
{
printf("Test\n");
}
There might also be a way to do it in C++, but I'm not sure.
In C language, what is the predefined buffered output stream?
stdout
In C language, what is the predefined buffered output stream?
stdout..
try checking it at
printf("%d",stdout);
In C language, what is the predefined buffered output stream?
stdout..
try checking it at
printf("%d",stdout);
In C language how to hide part of my code. I tried library file but it still shows the souce.?
I assume by hiding you mean the functionality of dll and ocx - components and objects as in VB.
In C, this is not possible. As you said, if you even use header files, the header file would still contain the source.
But when you develop a complete project in C, normally you do not distribute the source code files. You just would use some custom tool to distribute the compiled obj and exe files.
These compiled files and executables obviously would not be showing your code.
If however, you need to give the source code to your client and still want to hide some portion of your code in it, I am afraid that is not possible in C.
Regards,
C.S. Chandrasekkar
In C language how to hide part of my code. I tried library file but it still shows the souce.?
What?
You mean a comment?
//this
or
/* this */
I don't know what you're talking about when you say "Hide" your code.... when you compile it, you can't get that code back. (well back in C anyway)
Reply:It sounds like you are just including a source file instead of a library. What you really need to do is compile the library functions into a binary library, without symbol tables of debugging info, and include a header file that defines any constants or data structures needed to use the library. This varies from one compiler to another and also by OS.
In C, this is not possible. As you said, if you even use header files, the header file would still contain the source.
But when you develop a complete project in C, normally you do not distribute the source code files. You just would use some custom tool to distribute the compiled obj and exe files.
These compiled files and executables obviously would not be showing your code.
If however, you need to give the source code to your client and still want to hide some portion of your code in it, I am afraid that is not possible in C.
Regards,
C.S. Chandrasekkar
In C language how to hide part of my code. I tried library file but it still shows the souce.?
What?
You mean a comment?
//this
or
/* this */
I don't know what you're talking about when you say "Hide" your code.... when you compile it, you can't get that code back. (well back in C anyway)
Reply:It sounds like you are just including a source file instead of a library. What you really need to do is compile the library functions into a binary library, without symbol tables of debugging info, and include a header file that defines any constants or data structures needed to use the library. This varies from one compiler to another and also by OS.
In c language int i;for(i=0;i;)printf("hai friend"); //no output for this program if u placed for(;0;) than
The place where '0' is condition so u must spcify the condition following program will explain
int i;
for (i=0;i%26lt;10;i++)
printf("hai friend");
the program will display 10 times
but what u mentioned what not correct
Happy learning
In c language int i;for(i=0;i;)printf("hai friend"); //no output for this program if u placed for(;0;) than
second part of "for " is condition. since your condition is false / 0, it will not go inside.
for(Initialisation; loop Condition; next operation)
Reply:1) Question makes no sense
2) Frame your question properly so that at least one can give proper answers that help you
3) Provide as much data as you can of the problem
4) In case of programs try to publish programs completely.
Reply:correct format of for loop is as follows
for(intialiser;condition;increment/dec...
eg:
for(i=1;i%26lt;=10;i++)
you can use this loop as
i=1;
for(;i%26lt;=10;)
{
i++;
}
Reply:The question is making no sense, there is no condition set...
please reconfirm your question..!
Reply:In you're Ques both the 'for' loops mean the same. The only thing is you will be wasting the memory for 'i' and also wasting the execotion time of the prog in the first loop.
The nxt time if you have you're Ques, please make it clear.
parts of a flower
int i;
for (i=0;i%26lt;10;i++)
printf("hai friend");
the program will display 10 times
but what u mentioned what not correct
Happy learning
In c language int i;for(i=0;i;)printf("hai friend"); //no output for this program if u placed for(;0;) than
second part of "for " is condition. since your condition is false / 0, it will not go inside.
for(Initialisation; loop Condition; next operation)
Reply:1) Question makes no sense
2) Frame your question properly so that at least one can give proper answers that help you
3) Provide as much data as you can of the problem
4) In case of programs try to publish programs completely.
Reply:correct format of for loop is as follows
for(intialiser;condition;increment/dec...
eg:
for(i=1;i%26lt;=10;i++)
you can use this loop as
i=1;
for(;i%26lt;=10;)
{
i++;
}
Reply:The question is making no sense, there is no condition set...
please reconfirm your question..!
Reply:In you're Ques both the 'for' loops mean the same. The only thing is you will be wasting the memory for 'i' and also wasting the execotion time of the prog in the first loop.
The nxt time if you have you're Ques, please make it clear.
parts of a flower
In c language can we use an identifier as #define int char?
I don't think you can use reserved words in #define statements. You cannot redefine an in as a char.
In c language can we use an identifier as #define int char?
Sure you can.The preprocessor know nothing about datatypes.Inthat case all ints(4 byte words) will become 1 byte chars.Might cause your program to crash or behave weird though.
Reply:yes you can. the first poster is correct.
In c language can we use an identifier as #define int char?
Sure you can.The preprocessor know nothing about datatypes.Inthat case all ints(4 byte words) will become 1 byte chars.Might cause your program to crash or behave weird though.
Reply:yes you can. the first poster is correct.
In C language how to hide part of my code. I tried library file but it still shows the souce.?
I assume by hiding you mean the functionality of dll and ocx - components and objects as in VB.
In C, this is not possible. As you said, if you even use header files, the header file would still contain the source.
But when you develop a complete project in C, normally you do not distribute the source code files. You just would use some custom tool to distribute the compiled obj and exe files.
These compiled files and executables obviously would not be showing your code.
If however, you need to give the source code to your client and still want to hide some portion of your code in it, I am afraid that is not possible in C.
Regards,
C.S. Chandrasekkar
In C language how to hide part of my code. I tried library file but it still shows the souce.?
What?
You mean a comment?
//this
or
/* this */
I don't know what you're talking about when you say "Hide" your code.... when you compile it, you can't get that code back. (well back in C anyway)
Reply:It sounds like you are just including a source file instead of a library. What you really need to do is compile the library functions into a binary library, without symbol tables of debugging info, and include a header file that defines any constants or data structures needed to use the library. This varies from one compiler to another and also by OS.
In C, this is not possible. As you said, if you even use header files, the header file would still contain the source.
But when you develop a complete project in C, normally you do not distribute the source code files. You just would use some custom tool to distribute the compiled obj and exe files.
These compiled files and executables obviously would not be showing your code.
If however, you need to give the source code to your client and still want to hide some portion of your code in it, I am afraid that is not possible in C.
Regards,
C.S. Chandrasekkar
In C language how to hide part of my code. I tried library file but it still shows the souce.?
What?
You mean a comment?
//this
or
/* this */
I don't know what you're talking about when you say "Hide" your code.... when you compile it, you can't get that code back. (well back in C anyway)
Reply:It sounds like you are just including a source file instead of a library. What you really need to do is compile the library functions into a binary library, without symbol tables of debugging info, and include a header file that defines any constants or data structures needed to use the library. This varies from one compiler to another and also by OS.
In c language int i;for(i=0;i;)printf("hai friend"); //no output for this program if u placed for(;0;) than
1) Question makes no sense
2) Frame your question properly so that at least one can give proper answers that help you
3) Provide as much data as you can of the problem
4) In case of programs try to publish programs completely.
In c language int i;for(i=0;i;)printf("hai friend"); //no output for this program if u placed for(;0;) than
correct format of for loop is as follows
for(intialiser;condition;increment/dec...
eg:
for(i=1;i%26lt;=10;i++)
you can use this loop as
i=1;
for(;i%26lt;=10;)
{
i++;
}
Reply:The question is making no sense, there is no condition set...
please reconfirm your question..!
Reply:The place where '0' is condition so u must spcify the condition following program will explain
int i;
for (i=0;i%26lt;10;i++)
printf("hai friend");
the program will display 10 times
but what u mentioned what not correct
Happy learning
Reply:second part of "for " is condition. since your condition is false / 0, it will not go inside.
for(Initialisation; loop Condition; next operation)
Reply:In you're Ques both the 'for' loops mean the same. The only thing is you will be wasting the memory for 'i' and also wasting the execotion time of the prog in the first loop.
The nxt time if you have you're Ques, please make it clear.
2) Frame your question properly so that at least one can give proper answers that help you
3) Provide as much data as you can of the problem
4) In case of programs try to publish programs completely.
In c language int i;for(i=0;i;)printf("hai friend"); //no output for this program if u placed for(;0;) than
correct format of for loop is as follows
for(intialiser;condition;increment/dec...
eg:
for(i=1;i%26lt;=10;i++)
you can use this loop as
i=1;
for(;i%26lt;=10;)
{
i++;
}
Reply:The question is making no sense, there is no condition set...
please reconfirm your question..!
Reply:The place where '0' is condition so u must spcify the condition following program will explain
int i;
for (i=0;i%26lt;10;i++)
printf("hai friend");
the program will display 10 times
but what u mentioned what not correct
Happy learning
Reply:second part of "for " is condition. since your condition is false / 0, it will not go inside.
for(Initialisation; loop Condition; next operation)
Reply:In you're Ques both the 'for' loops mean the same. The only thing is you will be wasting the memory for 'i' and also wasting the execotion time of the prog in the first loop.
The nxt time if you have you're Ques, please make it clear.
In C language How to write some functions in header file and include it to the main program.?
WIthin c language you have can do functions as define within the header file.
For instance:
#if defined(linux) || defined(__APPLE__)
# if !defined(TRUE)
# define TRUE 1
# endif
# if !defined(FALSE)
# define FALSE 0
# endif
# if !defined(max)
# define max(a,b) (((a) %26gt; (b)) ? (a) : (b))
# endif
# if !defined(min)
# define min(a,b) (((a) %26lt; (b)) ? (a) : (b))
# endif
# if !defined(MB_OK)
# define MB_OK 0
# endif
# if !defined(Sleep)
# define Sleep(x) usleep((x) * 1000)
# endif
#endif /* linux || __APPLE__ */
Or you could do something like this which is a macro.
#define TEST_DEVICE(X) (((X).errorCode) != HD_SUCCESS)
So usually within header files we just include typedefs, defines, and functions.
IF we include functions, then in the main class we implement those functions. Think of it as a interface.
For instance:
index.h
=================================
void hdBeginFrame(int hHD);
void hdEndFrame(int hHD);
index.c
=====================
void hdBeginFrame(int hHD) {
.....
}
So instead of declaring the functions in your .c file at the beginning , you could do them within the header file.
IT acts as a interface in other languages. The reason why we have .h files is simple portability. When developers compile their code or module into dlls or so objects and they want their clients to use them, they can check the .h files to see which functions are included within that dll.
That is how we can do it. :)
In C language How to write some functions in header file and include it to the main program.?
just define or declare the functiom in the header file and do the rest in ur C code. But ermember to include the header file. And keep notice of %26lt; and "
Reply:you can save you code in .h extention and you can include that code in any of your project.
Reply:You can write the functions in the header file if you like, be sure to include the necessary class declarations and header file declarations in the .cpp. You could also place your functions at the end of your main function in the .cpp
Reply:Write your functions in a C file (with extension .c) and then include that file in any other C program using double quotes:
#include"file.c"
Note: Your file.c should be in same folder in which you C program which is using file.c, is kept.
Reply:1)lets say u have function name myfunc() in Function.h
void MyFunc();
2)now make a Function.cpp file and write following lines in it
void MyFunc()
{
printf("hello");
}
now, make another file named Main.c , which contains ur main() method
Include function.h in ur main.c file by putting this line at the top
%26lt;#inculde function.h%26gt;
Then goes the main() function
void main()
{
//call myfunc to print on the screen
MyFunc();
}
mothers day flowers
For instance:
#if defined(linux) || defined(__APPLE__)
# if !defined(TRUE)
# define TRUE 1
# endif
# if !defined(FALSE)
# define FALSE 0
# endif
# if !defined(max)
# define max(a,b) (((a) %26gt; (b)) ? (a) : (b))
# endif
# if !defined(min)
# define min(a,b) (((a) %26lt; (b)) ? (a) : (b))
# endif
# if !defined(MB_OK)
# define MB_OK 0
# endif
# if !defined(Sleep)
# define Sleep(x) usleep((x) * 1000)
# endif
#endif /* linux || __APPLE__ */
Or you could do something like this which is a macro.
#define TEST_DEVICE(X) (((X).errorCode) != HD_SUCCESS)
So usually within header files we just include typedefs, defines, and functions.
IF we include functions, then in the main class we implement those functions. Think of it as a interface.
For instance:
index.h
=================================
void hdBeginFrame(int hHD);
void hdEndFrame(int hHD);
index.c
=====================
void hdBeginFrame(int hHD) {
.....
}
So instead of declaring the functions in your .c file at the beginning , you could do them within the header file.
IT acts as a interface in other languages. The reason why we have .h files is simple portability. When developers compile their code or module into dlls or so objects and they want their clients to use them, they can check the .h files to see which functions are included within that dll.
That is how we can do it. :)
In C language How to write some functions in header file and include it to the main program.?
just define or declare the functiom in the header file and do the rest in ur C code. But ermember to include the header file. And keep notice of %26lt; and "
Reply:you can save you code in .h extention and you can include that code in any of your project.
Reply:You can write the functions in the header file if you like, be sure to include the necessary class declarations and header file declarations in the .cpp. You could also place your functions at the end of your main function in the .cpp
Reply:Write your functions in a C file (with extension .c) and then include that file in any other C program using double quotes:
#include"file.c"
Note: Your file.c should be in same folder in which you C program which is using file.c, is kept.
Reply:1)lets say u have function name myfunc() in Function.h
void MyFunc();
2)now make a Function.cpp file and write following lines in it
void MyFunc()
{
printf("hello");
}
now, make another file named Main.c , which contains ur main() method
Include function.h in ur main.c file by putting this line at the top
%26lt;#inculde function.h%26gt;
Then goes the main() function
void main()
{
//call myfunc to print on the screen
MyFunc();
}
mothers day flowers
In c language can we use an identifier as #define int char?
I don't think you can use reserved words in #define statements. You cannot redefine an in as a char.
In c language can we use an identifier as #define int char?
Sure you can.The preprocessor know nothing about datatypes.Inthat case all ints(4 byte words) will become 1 byte chars.Might cause your program to crash or behave weird though.
Reply:yes you can. the first poster is correct.
In c language can we use an identifier as #define int char?
Sure you can.The preprocessor know nothing about datatypes.Inthat case all ints(4 byte words) will become 1 byte chars.Might cause your program to crash or behave weird though.
Reply:yes you can. the first poster is correct.
In c language,give me the program of how to bounce the circle,?
i need the source code,im a IT student
In c language,give me the program of how to bounce the circle,?
~I didn't understand the question at all!! add details and give me something to work with so I can help!!
In c language,give me the program of how to bounce the circle,?
~I didn't understand the question at all!! add details and give me something to work with so I can help!!
What are the advantanges of C language over C++ language?
The obvious advantages are those given by Object Oriented Programming over procedural programming. Besides, C++ is a bit more friendly and exists with a higher level interface for the user.
What are the advantanges of C language over C++ language?
Well, C is in some sense simpler. C++ is a superset of C, meaning that it contains everything in C and then some. You should (but this doesn't always work) be able to compile a program written in C with a C++ compiler. So, to learn C, there is less you need to learn.
On the other hand, C++ does have more meat to it. It's what's called an object oriented language, which allows you to (at least more easily) write programs in different ways than you would in C. It also has some more advanced memory handling syntax, and other features that many programmers find useful.
As a final verdict, if you have a choice (which is not always the case), it's a matter of personal preference. There's nothing that can't be accomplished in C that you can accomplish in C++ and vice versa (though C++ might make some things easier). If you're learning a first language, you might as well at least start with C, and perhaps follow it up with C++.
My own preference is for C, as I never quite liked C++'s implementation of object oriented programming.
Reply:Well, they're both different computer languages, except that C is more of a beginner's language than C++.
Reply:Well, in my (highly opinionated) opinion, C was created by a working computer scientist to be used to write the UNIX operating system, C++ was made popular by academic computer scientists looking for ways to justify their existence, and compiler vendors looking for ways to get more of your money.
C is an efficient if terse language that allows to programmer to do almost anything they want to (including making huge errors)
C++ on the other hand has multiple layers of obscuration, bizarre jargon, and "powerful features" with very high abuse potential.
Note: the opinions expressed here are not necessarily those of anyone who knows anything about anything.
What are the advantanges of C language over C++ language?
Well, C is in some sense simpler. C++ is a superset of C, meaning that it contains everything in C and then some. You should (but this doesn't always work) be able to compile a program written in C with a C++ compiler. So, to learn C, there is less you need to learn.
On the other hand, C++ does have more meat to it. It's what's called an object oriented language, which allows you to (at least more easily) write programs in different ways than you would in C. It also has some more advanced memory handling syntax, and other features that many programmers find useful.
As a final verdict, if you have a choice (which is not always the case), it's a matter of personal preference. There's nothing that can't be accomplished in C that you can accomplish in C++ and vice versa (though C++ might make some things easier). If you're learning a first language, you might as well at least start with C, and perhaps follow it up with C++.
My own preference is for C, as I never quite liked C++'s implementation of object oriented programming.
Reply:Well, they're both different computer languages, except that C is more of a beginner's language than C++.
Reply:Well, in my (highly opinionated) opinion, C was created by a working computer scientist to be used to write the UNIX operating system, C++ was made popular by academic computer scientists looking for ways to justify their existence, and compiler vendors looking for ways to get more of your money.
C is an efficient if terse language that allows to programmer to do almost anything they want to (including making huge errors)
C++ on the other hand has multiple layers of obscuration, bizarre jargon, and "powerful features" with very high abuse potential.
Note: the opinions expressed here are not necessarily those of anyone who knows anything about anything.
What c language to be usedto make calculator?
you can create a calculator in c, c++ and java. But for me I prefer java because it has the best gui offers.
Hope my grammar is correct, hahaha!
What c language to be usedto make calculator?
To keep it C, use python. python offers the tkinter widgets so you have buttons, GUI, frames, etc. Otherwise you need the KDE in Linux to make a C app with a GUI.
Reply:C++ is good for GUI elements and calculations.
Reply:java is best to make calculator rather than c
song downloads
Hope my grammar is correct, hahaha!
What c language to be usedto make calculator?
To keep it C, use python. python offers the tkinter widgets so you have buttons, GUI, frames, etc. Otherwise you need the KDE in Linux to make a C app with a GUI.
Reply:C++ is good for GUI elements and calculations.
Reply:java is best to make calculator rather than c
song downloads
In c language wat is the output for this statement printf("%2.5d",10); plz give me the reson?
the output would be 10 but there is a 2.5 idention... im not sure if it is measure by inch or whatsoever but there will be a space before 10 and im sure to that...
In c language wat is the output for this statement printf("%2.5d",10); plz give me the reson?
it prints 00010
%d prints an integer
2.5 is used to format the print. the 2 means that it skips two spaces then prints the 10. .5 means that if the output occupies less than 5 spaces then it prints the number and fills all spaces with zeroes.
Reply:it prints:
10.00000
because the % is a formatting flag, the 2 means 2 digits before the decimal, the 5 means 5 digits after the decimal, the d means a double will follow after the comma, and the 10 after the comma is the number to print.
In c language wat is the output for this statement printf("%2.5d",10); plz give me the reson?
it prints 00010
%d prints an integer
2.5 is used to format the print. the 2 means that it skips two spaces then prints the 10. .5 means that if the output occupies less than 5 spaces then it prints the number and fills all spaces with zeroes.
Reply:it prints:
10.00000
because the % is a formatting flag, the 2 means 2 digits before the decimal, the 5 means 5 digits after the decimal, the d means a double will follow after the comma, and the 10 after the comma is the number to print.
In C language , which data type is used to store 124.6012222111?
in C u got some extended or derived data types to store decimals with that accuracy. The one u need is "long double"
In C language , which data type is used to store 124.6012222111?
i think its float but im not 100% sure
Reply:double
In C language , which data type is used to store 124.6012222111?
i think its float but im not 100% sure
Reply:double
In c language whenever if we want to make an exit from a loop why do we write inside the loop as exit(0);?
First: do not exit from the loop with exit(0). This will exit from your program.
Second: you can exit a loop by using break;
example1
#include %26lt;stdio.h%26gt;
int main(void)
{
int i=0;
while (1) // an infinite loop
{
i++;
printf("%d ",i);
if (i==7)
break; // not exit(0)
}
return 0;
}
But please create only
conditional loops:
while (i!=7)
{
i++;
printf("%d ",i);
}
In this case the loop will
exit when i==7
About the exit(0) function.
This will terminate your program.
Use it only when you have some
problems and you can't do
anything to solve them:
#include %26lt;stdio.h%26gt;
#include %26lt;stdlib.h%26gt;
int main(void)
{
int i=5;
myerror(5);
return 0;
}
int myerror(int i)
{
if (i==5){
printf("Oups!\n");
printf("I must exit!\n");
exit(EXIT_FAILURE);
//better than exit(0);
} // from if
return 0;
}
I hope this will help u.
In c language whenever if we want to make an exit from a loop why do we write inside the loop as exit(0);?
It is very rare to use exit(). Generally, you would use that function to immediately terminate the program. The program will exit differently, than if you exited a program with something like, 'return 0;'
If you want to exit out of a program normally, use something like 'return %26lt;int%26gt;'.
Hint on loops:
You use a 'for' loop if you know the number of iterations that the loop will make.
There is very little reason to have to forcibly exit out of a 'for' loop.
You use a 'while' loop if you don't know how many times a loop will execute. As the word 'while' hints at, a While loop will execute until a variable has changed to meet a certain condition, such as 'while (a%26lt;15)'
Reply:use: break;, exit(0) only for progam exit
Reply:Use that when you want to exit the loop from inside. It is not necessary if the loop exits at the end normally. Use it only for an abnormal loop ending.
Setting exit(1) would be used if this is an error detection of some sort.
In fact, good coding means that you do not work a loop exit from the middle. Always design around using a technique that tests for all possible end conditions as a part of the loop structure. You see, these weird loop exits become hard for others to understand.
Reply:in c programming language
we need to write exit(0);
because 'o' refer to a function called in a loop
and exit mean to go out of a function
and ; mean end of a statement
Second: you can exit a loop by using break;
example1
#include %26lt;stdio.h%26gt;
int main(void)
{
int i=0;
while (1) // an infinite loop
{
i++;
printf("%d ",i);
if (i==7)
break; // not exit(0)
}
return 0;
}
But please create only
conditional loops:
while (i!=7)
{
i++;
printf("%d ",i);
}
In this case the loop will
exit when i==7
About the exit(0) function.
This will terminate your program.
Use it only when you have some
problems and you can't do
anything to solve them:
#include %26lt;stdio.h%26gt;
#include %26lt;stdlib.h%26gt;
int main(void)
{
int i=5;
myerror(5);
return 0;
}
int myerror(int i)
{
if (i==5){
printf("Oups!\n");
printf("I must exit!\n");
exit(EXIT_FAILURE);
//better than exit(0);
} // from if
return 0;
}
I hope this will help u.
In c language whenever if we want to make an exit from a loop why do we write inside the loop as exit(0);?
It is very rare to use exit(). Generally, you would use that function to immediately terminate the program. The program will exit differently, than if you exited a program with something like, 'return 0;'
If you want to exit out of a program normally, use something like 'return %26lt;int%26gt;'.
Hint on loops:
You use a 'for' loop if you know the number of iterations that the loop will make.
There is very little reason to have to forcibly exit out of a 'for' loop.
You use a 'while' loop if you don't know how many times a loop will execute. As the word 'while' hints at, a While loop will execute until a variable has changed to meet a certain condition, such as 'while (a%26lt;15)'
Reply:use: break;, exit(0) only for progam exit
Reply:Use that when you want to exit the loop from inside. It is not necessary if the loop exits at the end normally. Use it only for an abnormal loop ending.
Setting exit(1) would be used if this is an error detection of some sort.
In fact, good coding means that you do not work a loop exit from the middle. Always design around using a technique that tests for all possible end conditions as a part of the loop structure. You see, these weird loop exits become hard for others to understand.
Reply:in c programming language
we need to write exit(0);
because 'o' refer to a function called in a loop
and exit mean to go out of a function
and ; mean end of a statement
In C language what is statements?
any syntactically correct expression or operation or function call, which does not contain any errors(on compilation) is a statement in C
In C language what is statements?
In C language Statements are
every thing writen in between opening and closing of currly braces that is in between {
--------
-----
}
this
Reply:a statement in c looks like this:
Include %26lt;string%26gt;; %26lt;= this is an include statement
{
cout %26lt;%26lt; "hello world" %26lt;%26lt; endl; %26lt;= output statement
}
Reply:in all programming languages statement means a line of code
example in C printf("hello world!"); or the if statement.. etc
Reply:A statement is pretty much any language is just a line of code that isn't a comment.
Rawlyn.
easter cards
In C language what is statements?
In C language Statements are
every thing writen in between opening and closing of currly braces that is in between {
--------
-----
}
this
Reply:a statement in c looks like this:
Include %26lt;string%26gt;; %26lt;= this is an include statement
{
cout %26lt;%26lt; "hello world" %26lt;%26lt; endl; %26lt;= output statement
}
Reply:in all programming languages statement means a line of code
example in C printf("hello world!"); or the if statement.. etc
Reply:A statement is pretty much any language is just a line of code that isn't a comment.
Rawlyn.
easter cards
In C language find transpose of a matrix using arrays?
Just sets rows to columns and vice versa:
for (int i = 0; i %26lt; columns; i++)
for (int j = 0; j %26lt; rows; j++)
transposeMatrix[i][j] = matrix[j][i];
for (int i = 0; i %26lt; columns; i++)
for (int j = 0; j %26lt; rows; j++)
transposeMatrix[i][j] = matrix[j][i];
Structures - C language?
Suppose that we represent a binary tree using link structures. The node structure is
typedef struct node {
char label[5];
int descendands
struct node *lchild, *rchild
} NODE;
Write a function that traverses the tree and initializes the member descendands when a node is visited. The value of descendands of a node is the number of descendants of the node. Write a program that tests the function. The function should be tested for three different trees, one tree should be empty, another should be just a list of length 5, the third one should be a tree of 7 nodes and 4 leafs.
Any answers/hints are welcome
Structures - C language?
You can visit my blog
http://codesbyshariq.blogspot.com for programs and code in C, C++, C#, Java, VB abd solutuions of the problems related to computers.
I have some programs related to DS so you can get hint from them.
Reply:Hint 1: You forgot to say whether you want pre-order, in-order, or post-order traversal. :)
Hint 2: Recursion is your friend. At any given node, desendants is equal to the sum of descendants of each child.
typedef struct node {
char label[5];
int descendands
struct node *lchild, *rchild
} NODE;
Write a function that traverses the tree and initializes the member descendands when a node is visited. The value of descendands of a node is the number of descendants of the node. Write a program that tests the function. The function should be tested for three different trees, one tree should be empty, another should be just a list of length 5, the third one should be a tree of 7 nodes and 4 leafs.
Any answers/hints are welcome
Structures - C language?
You can visit my blog
http://codesbyshariq.blogspot.com for programs and code in C, C++, C#, Java, VB abd solutuions of the problems related to computers.
I have some programs related to DS so you can get hint from them.
Reply:Hint 1: You forgot to say whether you want pre-order, in-order, or post-order traversal. :)
Hint 2: Recursion is your friend. At any given node, desendants is equal to the sum of descendants of each child.
Basic C language: help with XML file output?
I have written my program successfully thus far, but can't find any help on coding for this last part. According to the assignment, I must "Output to stdout the number of records output to the XML file."
(# of records is the result of the program execution)
Any serious help is appreciated! Thanks.
Basic C language: help with XML file output?
Without more details, all I can say is that you need to count the number of records you output in your XML file. Unless global variables are a no-no in your assignment, just initialize a global counter to zero, increment it every time you output a record and at the end of your record outputs, output the counter:
int g_nRecordCount = 0;
// Every time you add a record to XML in your code, increment counter
g_nRecordCount++;
// After completion of XML record output, output the record count
printf("%d XML records output.\n", g_nRecordCount);
(# of records is the result of the program execution)
Any serious help is appreciated! Thanks.
Basic C language: help with XML file output?
Without more details, all I can say is that you need to count the number of records you output in your XML file. Unless global variables are a no-no in your assignment, just initialize a global counter to zero, increment it every time you output a record and at the end of your record outputs, output the counter:
int g_nRecordCount = 0;
// Every time you add a record to XML in your code, increment counter
g_nRecordCount++;
// After completion of XML record output, output the record count
printf("%d XML records output.\n", g_nRecordCount);
Ok, C language once more?
#include%26lt;stdio.h%26gt;
main()
{int mas[5]={0};
int *p;
int i;
p=mas;
system("cls");
i=0;
do
{
*(p+i)=i;
i++;
printf("\n mas[%d]=%d",i,*(p+i));
}while(i%26lt;5);
}
So, when i compiel it, it shows me something like
mas[1]=21424
mas[2]=125215
.....
mas[5=21215 %26lt;%26lt;%26lt;?????why` that??
and I thought, that it would be sometnhing like
mas[1]=0
mas[2]=1
and so on...why isn`t it???
Ok, C language once more?
You don't give details about your environment (OS, Compiler, Debur ou Build mode, ...) but
initialization is incomplete:
int mas[5] = {0,0,0,0,0} is the code required to init all elements of he array (at least in my compiler ...)
However this has no impact on the following code ...
Arrays in C and C++ are zero-based, meaning that the first element is mas[0] and not mas[1];
You need to swap the line 'i++' and the line 'printf...'
You init the mas[0] and display the mas[1] BEFORE it is initialized because it is init in the next round of the do while loop ...
Here is the code
i = 0;
do
{
*(p+i)=i;
printf("\n mas[%d]=%d",i,*(p+i));
i++;
}while(i%26lt;5);
Thierry
Web: www.tgmdev.be
Download Isanaki 2.1a at www.tgmdev.be, the last version of Isanaki, a free Sudoku and Wordoku Generator, Solver and Helper ...
Reply:Actually the arror is here : *(p+i)=i;
you dont have to increment it directly.Since you have passed the address of array mas to p.It will increment with each assigning.
You got the error early because the integer value addess will increment by 2 each time since integer value has 2 bits.
Here is the corrected code
#include%26lt;stdlib.h%26gt;
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
void main()
{int mas[5]={0};
int i=0;
int *p;
p=mas;
system("cls");
do
{
*(p)=i++;
printf("\n mas[%d]=%d",i,*(p));
}while(i%26lt;5);
getch();
}
brenda song
main()
{int mas[5]={0};
int *p;
int i;
p=mas;
system("cls");
i=0;
do
{
*(p+i)=i;
i++;
printf("\n mas[%d]=%d",i,*(p+i));
}while(i%26lt;5);
}
So, when i compiel it, it shows me something like
mas[1]=21424
mas[2]=125215
.....
mas[5=21215 %26lt;%26lt;%26lt;?????why` that??
and I thought, that it would be sometnhing like
mas[1]=0
mas[2]=1
and so on...why isn`t it???
Ok, C language once more?
You don't give details about your environment (OS, Compiler, Debur ou Build mode, ...) but
initialization is incomplete:
int mas[5] = {0,0,0,0,0} is the code required to init all elements of he array (at least in my compiler ...)
However this has no impact on the following code ...
Arrays in C and C++ are zero-based, meaning that the first element is mas[0] and not mas[1];
You need to swap the line 'i++' and the line 'printf...'
You init the mas[0] and display the mas[1] BEFORE it is initialized because it is init in the next round of the do while loop ...
Here is the code
i = 0;
do
{
*(p+i)=i;
printf("\n mas[%d]=%d",i,*(p+i));
i++;
}while(i%26lt;5);
Thierry
Web: www.tgmdev.be
Download Isanaki 2.1a at www.tgmdev.be, the last version of Isanaki, a free Sudoku and Wordoku Generator, Solver and Helper ...
Reply:Actually the arror is here : *(p+i)=i;
you dont have to increment it directly.Since you have passed the address of array mas to p.It will increment with each assigning.
You got the error early because the integer value addess will increment by 2 each time since integer value has 2 bits.
Here is the corrected code
#include%26lt;stdlib.h%26gt;
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
void main()
{int mas[5]={0};
int i=0;
int *p;
p=mas;
system("cls");
do
{
*(p)=i++;
printf("\n mas[%d]=%d",i,*(p));
}while(i%26lt;5);
getch();
}
brenda song
In C language,what are the parameters sent to main function?
int main(int argc, char **argv, char **env);
In C language,what are the parameters sent to main function?
Tell you what. I haven't coded a single line since May 2002. That's because I never got another job ever since May 2002.
When I answered this question, I did not refer to any book/manual. I just followed my instincts because right away I knew that the other answers were certainly wrong. Report It
Reply:int main(int argc, char *argv[]);
argc is number of arguments.
argv is array of pointers to "strings"
Reply:The main function definition in C is
void main(int argc, char *argv[]);
Suppose you have and exe file which is created using C program. Assume the name of the file is foo.exe. Now while you run this file you can pass arguments to the exe file like
foo 1 2 sridevi
In this case value of your argc will be 3, as there are 3 parameters passed. argv will store these parameters. so argv[1] = 1; argv[2] = 2; argv[3] = sridevi.
You can not pass these parameters in program. These must be passed at the run time.
Reply:The main function can accept parameter from the command line as arguments.
To accept arguments, you should declare the main function as bellow
int main( int argc, char *argv[] )
In that, argc is the number of argument, include the program name itself, and argv contains values of arguments.
Example:
With the above declaration, the program name is prg1, and if you type in the command line:
%26gt; prg1 abc 333
argc will be 3
and argv[0] = prg1
argv[1] = abc
argv[2] = 333
In C language,what are the parameters sent to main function?
Tell you what. I haven't coded a single line since May 2002. That's because I never got another job ever since May 2002.
When I answered this question, I did not refer to any book/manual. I just followed my instincts because right away I knew that the other answers were certainly wrong. Report It
Reply:int main(int argc, char *argv[]);
argc is number of arguments.
argv is array of pointers to "strings"
Reply:The main function definition in C is
void main(int argc, char *argv[]);
Suppose you have and exe file which is created using C program. Assume the name of the file is foo.exe. Now while you run this file you can pass arguments to the exe file like
foo 1 2 sridevi
In this case value of your argc will be 3, as there are 3 parameters passed. argv will store these parameters. so argv[1] = 1; argv[2] = 2; argv[3] = sridevi.
You can not pass these parameters in program. These must be passed at the run time.
Reply:The main function can accept parameter from the command line as arguments.
To accept arguments, you should declare the main function as bellow
int main( int argc, char *argv[] )
In that, argc is the number of argument, include the program name itself, and argv contains values of arguments.
Example:
With the above declaration, the program name is prg1, and if you type in the command line:
%26gt; prg1 abc 333
argc will be 3
and argv[0] = prg1
argv[1] = abc
argv[2] = 333
Multiply two matrices 3x4 using c++ language?
What kind of multiplication?
Are you looking for the dot product or cross product? Or maybe you are doing element by element with answer also being a 3x4 matrix?
Need more info
Multiply two matrices 3x4 using c++ language?
"The standard library does not provide a matrix class. Instead, the intent is for valarray and slice to provide the tools for building matrices optimized for a variety of needs."
Are you looking for the dot product or cross product? Or maybe you are doing element by element with answer also being a 3x4 matrix?
Need more info
Multiply two matrices 3x4 using c++ language?
"The standard library does not provide a matrix class. Instead, the intent is for valarray and slice to provide the tools for building matrices optimized for a variety of needs."
In c language 0 Menes false,for(;0;)printf("hello"); than y its printing hello?
This is really a good question.
The compiler will completely ignore the words "for(;0;)" and will start with the next print statement as if it is not in the "for" loop at all.
Since there is no syntax error in this, it will get compiled but since the linker knows that the statement following it cannot be reached, it gives us a warning but when you execute, this line will be completly ignored and the next line will be treated as the next line of code. It will not be treated as a loop at all as it has ignored that part. Please note that the warnings are for programmers information and not for the compiler.
Just try typing "0;" alone in a line and use "step over (F8)" option. You can see this line will not be executed at all but will get compiled as there is no syntax error.
We can even say it is a kind of bug which the programmer should take care. Also this is not the only thing with C to be taken care, there are lot more to be taken care by the programmer like this one. Hope this clarifies your doubt.
In c language 0 Menes false,for(;0;)printf("hello"); than y its printing hello?
have you tried this statement?
The "printf" statement is unreachable.
then how can you have it displayed?
You might have inlcluded ';'(semicolon) after "for" statement.
Verify.
Reply:try the following
for(;0;) {
printf("hello");
}
it is printing anything
I am sure it will not be coz u included ; at the end of for loop
The compiler will completely ignore the words "for(;0;)" and will start with the next print statement as if it is not in the "for" loop at all.
Since there is no syntax error in this, it will get compiled but since the linker knows that the statement following it cannot be reached, it gives us a warning but when you execute, this line will be completly ignored and the next line will be treated as the next line of code. It will not be treated as a loop at all as it has ignored that part. Please note that the warnings are for programmers information and not for the compiler.
Just try typing "0;" alone in a line and use "step over (F8)" option. You can see this line will not be executed at all but will get compiled as there is no syntax error.
We can even say it is a kind of bug which the programmer should take care. Also this is not the only thing with C to be taken care, there are lot more to be taken care by the programmer like this one. Hope this clarifies your doubt.
In c language 0 Menes false,for(;0;)printf("hello"); than y its printing hello?
have you tried this statement?
The "printf" statement is unreachable.
then how can you have it displayed?
You might have inlcluded ';'(semicolon) after "for" statement.
Verify.
Reply:try the following
for(;0;) {
printf("hello");
}
it is printing anything
I am sure it will not be coz u included ; at the end of for loop
Write program in c language to remove all comment lines from a existing c file?
Show us what you have so far instead of putting no effort into it at all.
Write program in c language to remove all comment lines from a existing c file?
Whenever you encounter //, remove it from the text until you read a newline. Whenever you encounter /*, remove it from the text until you read */
It shouldn't be that hard.
bouquet
Write program in c language to remove all comment lines from a existing c file?
Whenever you encounter //, remove it from the text until you read a newline. Whenever you encounter /*, remove it from the text until you read */
It shouldn't be that hard.
bouquet
How c language can be useful in real life?
Any learning is useful, even if it is to see how silly things are. Have you actually studied C Language? If not, then don't knock it. Computer Programmers make very good money.
How c language can be useful in real life?
it cant be
How c language can be useful in real life?
it cant be
In C++ Language, How to use cstring header file?
The cstring header file defines quite a few *low level* character string management functions for C-style strings (read: null terminated array of char's). This is most likely not what you want to deal with in C++.
For basic string management, under C++, I would recommend you use the STL string object for string management instead of string.h.
The references at the end have examples.
But, if you insist on using cstring.h just #include%26lt;string.h%26gt; in your code and you are ready to use any of the functions described here: http://www.cplusplus.com/reference/clibr...
In C++ Language, How to use cstring header file?
#include %26lt;afx.h%26gt;
For basic string management, under C++, I would recommend you use the STL string object for string management instead of string.h.
The references at the end have examples.
But, if you insist on using cstring.h just #include%26lt;string.h%26gt; in your code and you are ready to use any of the functions described here: http://www.cplusplus.com/reference/clibr...
In C++ Language, How to use cstring header file?
#include %26lt;afx.h%26gt;
In c language(strings) can we combine two strings by statement s3=s1+s2 if they are declaired as *s1,*s2,*s3?
The std::string class already overloads operator+() to allow string concatenation. But as you have declared your variables as pointers to strings, you need to dereference them before you can do this.
std::string *s1,*s2,*s3;
//
*s3 = (*s1)+(*s2) rather than s3=s1+s2
Now, do the rest of your homework yourself. All you have to do is type the damn things into a C interpreter.
In c language(strings) can we combine two strings by statement s3=s1+s2 if they are declaired as *s1,*s2,*s3?
no you cant, you can you apply addition operation on two strings ? be logical !
you can try the below code for string concatenation
#include%26lt;string.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;stdio.h%26gt;
void main()
{
char s1[10],s2[10];
printf("\n enter string 1");
gets(s1);
printf("\n enter string 2");
gets(s2);
strcat(s1,s2);
puts(s1);
getch();
}
Reply:Nope.... Ucan use strcat(); function to concatenate two strings.....Go to help page of strcat() function to find how to use parameters for that function as per your needs.
U can use + to concatenate strings only using Operator Overloading (polymorphism Feature) which can be used in Object Oriented Programs like C++...
Reply:You have asked at least ten questions today, looks like all these are your project assignment, may be you can contact a freelance programmer to do it for you. Check websites like http://getafreelnacer.com/
std::string *s1,*s2,*s3;
//
*s3 = (*s1)+(*s2) rather than s3=s1+s2
Now, do the rest of your homework yourself. All you have to do is type the damn things into a C interpreter.
In c language(strings) can we combine two strings by statement s3=s1+s2 if they are declaired as *s1,*s2,*s3?
no you cant, you can you apply addition operation on two strings ? be logical !
you can try the below code for string concatenation
#include%26lt;string.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;stdio.h%26gt;
void main()
{
char s1[10],s2[10];
printf("\n enter string 1");
gets(s1);
printf("\n enter string 2");
gets(s2);
strcat(s1,s2);
puts(s1);
getch();
}
Reply:Nope.... Ucan use strcat(); function to concatenate two strings.....Go to help page of strcat() function to find how to use parameters for that function as per your needs.
U can use + to concatenate strings only using Operator Overloading (polymorphism Feature) which can be used in Object Oriented Programs like C++...
Reply:You have asked at least ten questions today, looks like all these are your project assignment, may be you can contact a freelance programmer to do it for you. Check websites like http://getafreelnacer.com/
For C language what is the difference b/w X-- or --X?
Can you provide some examples in the output?
For C language what is the difference b/w X-- or --X?
x-- means after the whole equation is solved then x is decremented.
--x is first decremented and then the equation is proceeds..
if
--x;
x--;
are just on a single line it doesn't matter if the decrementing is after or before the x because there is no other variable besides x but suppose:
y = 5;
x = 6
y = y + x--;
y would get 11. That decrementing would not make a difference on the present equation and after the equation is completed you x would get 5
y = y + --x; would get 10. hope that helps. the x is first decremented and then the equation is solved.
Reply:i++ will use the value of i in the statement and then increment
++i will increment i and then use the value in the statement
int i = 0;
cout %26lt;%26lt; i++; //Prints out 0 then adds 1 to i
//i == 1
cout %26lt;%26lt; ++i; //Prints 2 Increment, then print the value of i
yu gi oh cards
For C language what is the difference b/w X-- or --X?
x-- means after the whole equation is solved then x is decremented.
--x is first decremented and then the equation is proceeds..
if
--x;
x--;
are just on a single line it doesn't matter if the decrementing is after or before the x because there is no other variable besides x but suppose:
y = 5;
x = 6
y = y + x--;
y would get 11. That decrementing would not make a difference on the present equation and after the equation is completed you x would get 5
y = y + --x; would get 10. hope that helps. the x is first decremented and then the equation is solved.
Reply:i++ will use the value of i in the statement and then increment
++i will increment i and then use the value in the statement
int i = 0;
cout %26lt;%26lt; i++; //Prints out 0 then adds 1 to i
//i == 1
cout %26lt;%26lt; ++i; //Prints 2 Increment, then print the value of i
yu gi oh cards
Write program in c language to remove all comment lines from a existing c file?
Show us what you have so far instead of putting no effort into it at all.
Write program in c language to remove all comment lines from a existing c file?
Whenever you encounter //, remove it from the text until you read a newline. Whenever you encounter /*, remove it from the text until you read */
It shouldn't be that hard.
Write program in c language to remove all comment lines from a existing c file?
Whenever you encounter //, remove it from the text until you read a newline. Whenever you encounter /*, remove it from the text until you read */
It shouldn't be that hard.
How c-language is invented.?
C was developed at Bell Laboratories in 1972 by Dennis Ritchie. Many of its principles and ideas were taken from the earlier language B and B's earlier ancestors BCPL and CPL. CPL ( Combined Programming Language ) was developed with the purpose of creating a language that was capable of both high level, machine independent programming and would still allow the programmer to control the behavior of individual bits of information. The one major drawback of CPL was that it was too large for use in many applications. In 1967, BCPL ( Basic CPL ) was created as a scaled down version of CPL while still retaining its basic features. In 1970, Ken Thompson, while working at Bell Labs, took this process further by developing the B language. B was a scaled down version of BCPL written specifically for use in systems programming. Finally in 1972, a co-worker of Ken Thompson, Dennis Ritchie, returned some of the generality found in BCPL to the B language in the process of developing the language we now know as C.
C's power and flexibility soon became apparent. Because of this, the Unix operating system which was originally written in assembly language, was almost immediately re-written in C ( only the assembly language code needed to "bootstrap" the C code was kept ). During the rest of the 1970's, C spread throughout many colleges and universities because of it's close ties to Unix and the availability of C compilers. Soon, many different organizations began using their own versions of C causing compatibility problems. In response to this in 1983, the American National Standards Institute ( ANSI ) formed a committee to establish a standard definition of C which became known as ANSI Standard C. Today C is in widespread use with a rich standard library of functions.
--------------------------------------...
Significant Language Features
C is a powerful, flexible language that provides fast program execution and imposes few constraints on the programmer. It allows low level access to information and commands while still retaining the portability and syntax of a high level language. These qualities make it a useful language for both systems programming and general purpose programs.
C's power and fast program execution come from it's ability to access low level commands, similar to assembly language, but with high level syntax. It's flexibility comes from the many ways the programmer has to accomplish the same tasks. C includes bitwise operators along with powerful pointer manipulation capabilities. C imposes few constraints on the programmer. The main area this shows up is in C's lack of type checking. This can be a powerful advantage to an experienced programmer but a dangerous disadvantage to a novice.
Another strong point of C is it's use of modularity. Sections of code can be stored in libraries for re-use in future programs. This concept of modularity also helps with C's portability and execution speed. The core C language leaves out many features included in the core of other languages. These functions are instead stored in the C Standard Library where they can be called on when needed.. An example of this concept would be C's lack of built in I/O capabilities. I/O functions tend to slow down program execution and also be machine independent when running optimally. For these reasons, they are stored in a library separately from the C language and only included when necessary.
--------------------------------------...
Areas of Application
The C programming language is used in many different areas of application, but the most prolific area is UNIX operating system applications. The C language is also used in computer games:
UNIX operating system
computer games
C's power and flexibility soon became apparent. Because of this, the Unix operating system which was originally written in assembly language, was almost immediately re-written in C ( only the assembly language code needed to "bootstrap" the C code was kept ). During the rest of the 1970's, C spread throughout many colleges and universities because of it's close ties to Unix and the availability of C compilers. Soon, many different organizations began using their own versions of C causing compatibility problems. In response to this in 1983, the American National Standards Institute ( ANSI ) formed a committee to establish a standard definition of C which became known as ANSI Standard C. Today C is in widespread use with a rich standard library of functions.
--------------------------------------...
Significant Language Features
C is a powerful, flexible language that provides fast program execution and imposes few constraints on the programmer. It allows low level access to information and commands while still retaining the portability and syntax of a high level language. These qualities make it a useful language for both systems programming and general purpose programs.
C's power and fast program execution come from it's ability to access low level commands, similar to assembly language, but with high level syntax. It's flexibility comes from the many ways the programmer has to accomplish the same tasks. C includes bitwise operators along with powerful pointer manipulation capabilities. C imposes few constraints on the programmer. The main area this shows up is in C's lack of type checking. This can be a powerful advantage to an experienced programmer but a dangerous disadvantage to a novice.
Another strong point of C is it's use of modularity. Sections of code can be stored in libraries for re-use in future programs. This concept of modularity also helps with C's portability and execution speed. The core C language leaves out many features included in the core of other languages. These functions are instead stored in the C Standard Library where they can be called on when needed.. An example of this concept would be C's lack of built in I/O capabilities. I/O functions tend to slow down program execution and also be machine independent when running optimally. For these reasons, they are stored in a library separately from the C language and only included when necessary.
--------------------------------------...
Areas of Application
The C programming language is used in many different areas of application, but the most prolific area is UNIX operating system applications. The C language is also used in computer games:
UNIX operating system
computer games
In c language how to find the product of two numbers without using arithmetic operators?
Here is the algorithm (dates from Egyptian times) :
http://www.bitwisemag.com/copy/wilf/wilf...
which translates into C like this:
#include %26lt;stdio.h%26gt;
void main() {
int z = 0, x=101 , y=91;
printf("%d * %d = " , x , y);
while(x %26gt;0) {
if(x%26amp;1) { // is x odd?
z += y;
}
y %26lt;%26lt;=1; // multiple y by 2
x %26gt;%26gt;= 1; // divide x by 2
}
printf("%d" , z);
}
This works but it also needs the + operation so we need to add a function for adding. Complete code is therefore:
#include %26lt;stdio.h%26gt;
unsigned int add(unsigned int a, unsigned int b)
{
unsigned int c= 0;
unsigned int r= 0;
unsigned int t;
for (t= ~0; t; t%26gt;%26gt;= 1)
{
r%26lt;%26lt;= 1;
r|= (a^b^c)%26amp;1;
c= ((a|b)%26amp;c|a%26amp;b)%26amp;1;
a%26gt;%26gt;= 1;
b%26gt;%26gt;= 1;
}
for (t= ~0, c= ~t; t; t%26gt;%26gt;= 1)
{
c%26lt;%26lt;= 1;
c|= r%26amp;1;
r%26gt;%26gt;= 1;
}
return c;
}
unsigned int mul(unsigned int a, unsigned int b)
{
unsigned int r=0;
while(a %26gt; 0)
{
if(a%26amp;1) {
r = add(r, b);
}
b%26lt;%26lt;=1;
a%26gt;%26gt;=1;
}
return r;
}
void main()
{
unsigned int x= 101 , y = 91;
printf("%d*%d= %d\n", x , y, mul(x, y));
}
Source :
http://www.gmonline.demon.co.uk/cscene/C...
Just for info, an introduction to bitwise operators :
http://www.codeproject.com/cpp/bitbashin...
Output is simply
101 * 91 = 9191
Change the values of x and y to check other products.
In c language how to find the product of two numbers without using arithmetic operators?
simple use assignment operator, *=
ie if ya need to multiply a and b
use a*=b;
Reply:by watching the two nos.they constitute the product itself.viz 1 %26amp; 2 are two nos then product of two nos 1 %26amp; 2 is 12
Reply:The only way that I know would only work if one of the numbers was a multiple of 2.
The %26lt;%26lt; (shift left) operator effectively multiplies the number by 2 the number of times specified by the argument.
For example x %26lt;%26lt; 4 multiplies x times 2, 4 times (same as * 16).
The %26lt;%26lt;= is also another way of multiplying by a multiple of 2 and assigning the result to the left side of the equation.
http://www.bitwisemag.com/copy/wilf/wilf...
which translates into C like this:
#include %26lt;stdio.h%26gt;
void main() {
int z = 0, x=101 , y=91;
printf("%d * %d = " , x , y);
while(x %26gt;0) {
if(x%26amp;1) { // is x odd?
z += y;
}
y %26lt;%26lt;=1; // multiple y by 2
x %26gt;%26gt;= 1; // divide x by 2
}
printf("%d" , z);
}
This works but it also needs the + operation so we need to add a function for adding. Complete code is therefore:
#include %26lt;stdio.h%26gt;
unsigned int add(unsigned int a, unsigned int b)
{
unsigned int c= 0;
unsigned int r= 0;
unsigned int t;
for (t= ~0; t; t%26gt;%26gt;= 1)
{
r%26lt;%26lt;= 1;
r|= (a^b^c)%26amp;1;
c= ((a|b)%26amp;c|a%26amp;b)%26amp;1;
a%26gt;%26gt;= 1;
b%26gt;%26gt;= 1;
}
for (t= ~0, c= ~t; t; t%26gt;%26gt;= 1)
{
c%26lt;%26lt;= 1;
c|= r%26amp;1;
r%26gt;%26gt;= 1;
}
return c;
}
unsigned int mul(unsigned int a, unsigned int b)
{
unsigned int r=0;
while(a %26gt; 0)
{
if(a%26amp;1) {
r = add(r, b);
}
b%26lt;%26lt;=1;
a%26gt;%26gt;=1;
}
return r;
}
void main()
{
unsigned int x= 101 , y = 91;
printf("%d*%d= %d\n", x , y, mul(x, y));
}
Source :
http://www.gmonline.demon.co.uk/cscene/C...
Just for info, an introduction to bitwise operators :
http://www.codeproject.com/cpp/bitbashin...
Output is simply
101 * 91 = 9191
Change the values of x and y to check other products.
In c language how to find the product of two numbers without using arithmetic operators?
simple use assignment operator, *=
ie if ya need to multiply a and b
use a*=b;
Reply:by watching the two nos.they constitute the product itself.viz 1 %26amp; 2 are two nos then product of two nos 1 %26amp; 2 is 12
Reply:The only way that I know would only work if one of the numbers was a multiple of 2.
The %26lt;%26lt; (shift left) operator effectively multiplies the number by 2 the number of times specified by the argument.
For example x %26lt;%26lt; 4 multiplies x times 2, 4 times (same as * 16).
The %26lt;%26lt;= is also another way of multiplying by a multiple of 2 and assigning the result to the left side of the equation.
In c language 0 Menes false,for(;0;)printf("hello"); than y its printing hello?
This is really a good question.
The compiler will completely ignore the words "for(;0;)" and will start with the next print statement as if it is not in the "for" loop at all.
Since there is no syntax error in this, it will get compiled but since the linker knows that the statement following it cannot be reached, it gives us a warning but when you execute, this line will be completly ignored and the next line will be treated as the next line of code. It will not be treated as a loop at all as it has ignored that part. Please note that the warnings are for programmers information and not for the compiler.
Just try typing "0;" alone in a line and use "step over (F8)" option. You can see this line will not be executed at all but will get compiled as there is no syntax error.
We can even say it is a kind of bug which the programmer should take care. Also this is not the only thing with C to be taken care, there are lot more to be taken care by the programmer like this one. Hope this clarifies your doubt.
In c language 0 Menes false,for(;0;)printf("hello"); than y its printing hello?
have you tried this statement?
The "printf" statement is unreachable.
then how can you have it displayed?
You might have inlcluded ';'(semicolon) after "for" statement.
Verify.
Reply:try the following
for(;0;) {
printf("hello");
}
it is printing anything
I am sure it will not be coz u included ; at the end of for loop
thank you cards
The compiler will completely ignore the words "for(;0;)" and will start with the next print statement as if it is not in the "for" loop at all.
Since there is no syntax error in this, it will get compiled but since the linker knows that the statement following it cannot be reached, it gives us a warning but when you execute, this line will be completly ignored and the next line will be treated as the next line of code. It will not be treated as a loop at all as it has ignored that part. Please note that the warnings are for programmers information and not for the compiler.
Just try typing "0;" alone in a line and use "step over (F8)" option. You can see this line will not be executed at all but will get compiled as there is no syntax error.
We can even say it is a kind of bug which the programmer should take care. Also this is not the only thing with C to be taken care, there are lot more to be taken care by the programmer like this one. Hope this clarifies your doubt.
In c language 0 Menes false,for(;0;)printf("hello"); than y its printing hello?
have you tried this statement?
The "printf" statement is unreachable.
then how can you have it displayed?
You might have inlcluded ';'(semicolon) after "for" statement.
Verify.
Reply:try the following
for(;0;) {
printf("hello");
}
it is printing anything
I am sure it will not be coz u included ; at the end of for loop
thank you cards
What is the differance between 'c' language and 'c++' language?
it is about the same kind of difference as between chinese and korean...
Both use letters, and are understood by computers. But the syntax, lexic and vocabularies are different.
Helps?
BTW, one being "oops", and the other one not is really bull... Create a struct in "C", shove some pointers to functions into it, and enjoy your very own "object".
Now, create another struct, with the previous one as the first field - and you have just discovered inheritance. Cast a pointer to the second one into a pointer to the first - and that is your polymorphism.
Another myth is that C++ is a "superset of C" or that you can compile a C program with a C++ compiler. This is not true. They look somewhat similar to a human eye, but formally are totally different laguages.
You could, probably, come up with some fairly simple C program, that can be compiled with C++, just like some Spanish words (and even sentenses) are also valid in French, but in general that is not true.
Function pointers are not compatible with void*, or with each other. Integers are not compatible with pointers, and are not assumed by default, you can't skip a type declaration etc, etc.
What is the differance between 'c' language and 'c++' language?
C++ is the superset of C.
Essentially, C++ offers advanced data management through advanced data structures such as classes, prototypes, polymorphism and templates.
In other words, C++ is an abstraction of C, making it easier for programmers to complete applications through clever uses of C++ object -oriented design and coding practices.
Reply:there're many, 4 eg, C is structural programming language...while C++ is Object oriented...
u can check these links 4 more details...
http://www.faqs.org/qa/qa-117.html
http://www.cprogramming.com/tutorial/c-v...
Reply:Well, C++ evolved from C. The major difference between the two is that C++ supports object-oriented design. C++ was initially an extension to C and, as a result, is backwards compatible (meaning you can use C code in C++ programs, but not vice versa).
Reply:the layout of C++ programs looks like C prorams, they starts generally with include statement. most instructions in C are used in C++, But there is a great difference, C++ is an object oriented programing language, that is it has classes which are not used in C. The person who knows C will not necessary be able to understand C++ programs. They have entirely different structure.
Reply:C++ offers more commands.
Reply:C is a procedural language whereas c++ is a object-oriented language.c is the basics to learn c++(though not necessary).Though both are equally powerful c++ offer some more good feature than compare to c.
Reply:the difference is the latter is object oriented ie oop and the former is only procedure oriented ie pop (p standing for program)
the latter is the development of the former
Reply:Essentially, C++ is object-oriented C. This means that C runs faster, but C++ has the power of OOP.
Rawlyn.
Both use letters, and are understood by computers. But the syntax, lexic and vocabularies are different.
Helps?
BTW, one being "oops", and the other one not is really bull... Create a struct in "C", shove some pointers to functions into it, and enjoy your very own "object".
Now, create another struct, with the previous one as the first field - and you have just discovered inheritance. Cast a pointer to the second one into a pointer to the first - and that is your polymorphism.
Another myth is that C++ is a "superset of C" or that you can compile a C program with a C++ compiler. This is not true. They look somewhat similar to a human eye, but formally are totally different laguages.
You could, probably, come up with some fairly simple C program, that can be compiled with C++, just like some Spanish words (and even sentenses) are also valid in French, but in general that is not true.
Function pointers are not compatible with void*, or with each other. Integers are not compatible with pointers, and are not assumed by default, you can't skip a type declaration etc, etc.
What is the differance between 'c' language and 'c++' language?
C++ is the superset of C.
Essentially, C++ offers advanced data management through advanced data structures such as classes, prototypes, polymorphism and templates.
In other words, C++ is an abstraction of C, making it easier for programmers to complete applications through clever uses of C++ object -oriented design and coding practices.
Reply:there're many, 4 eg, C is structural programming language...while C++ is Object oriented...
u can check these links 4 more details...
http://www.faqs.org/qa/qa-117.html
http://www.cprogramming.com/tutorial/c-v...
Reply:Well, C++ evolved from C. The major difference between the two is that C++ supports object-oriented design. C++ was initially an extension to C and, as a result, is backwards compatible (meaning you can use C code in C++ programs, but not vice versa).
Reply:the layout of C++ programs looks like C prorams, they starts generally with include statement. most instructions in C are used in C++, But there is a great difference, C++ is an object oriented programing language, that is it has classes which are not used in C. The person who knows C will not necessary be able to understand C++ programs. They have entirely different structure.
Reply:C++ offers more commands.
Reply:C is a procedural language whereas c++ is a object-oriented language.c is the basics to learn c++(though not necessary).Though both are equally powerful c++ offer some more good feature than compare to c.
Reply:the difference is the latter is object oriented ie oop and the former is only procedure oriented ie pop (p standing for program)
the latter is the development of the former
Reply:Essentially, C++ is object-oriented C. This means that C runs faster, but C++ has the power of OOP.
Rawlyn.
In C language, how do i pick 100 random numbers between 40 and 50 inclusive?
Here it goes:
srand( (unsigned)time(NULL));
int myRandomNumbers[100];
for (int i=0; i%26lt;100; i++)
{
myRandomNumbers[i] = 40 + int(11*(rand()/double(RAND_MAX+1)));
}
for (int t=0; t%26lt;100; t++)
{
printf("%d\n", myRandomNumbers[t]);
}
// Have fun,
// S. B.
srand( (unsigned)time(NULL));
int myRandomNumbers[100];
for (int i=0; i%26lt;100; i++)
{
myRandomNumbers[i] = 40 + int(11*(rand()/double(RAND_MAX+1)));
}
for (int t=0; t%26lt;100; t++)
{
printf("%d\n", myRandomNumbers[t]);
}
// Have fun,
// S. B.
How to convert c language to c language?
Hit your head to the monitor 3 times, and say Jaja ki Baja!
thats it!
How to convert c language to c language?
copy the file?
thats it!
How to convert c language to c language?
copy the file?
Is java language written in c language ?
Java is written in C and Mesa. see: http://en.wikipedia.org/wiki/Java_%28Sun...
it is perfectly possible to write an OO language with a non-OO language. Since OO is only a concept where Variables are stored in objects i.e stored in a structured way. It is however almost impossible to write OO-ly in that non-OO language itself.
Note: it's class however is written on Java. Classes are reusable code that is written by the language developer to increase functionality. Most class for a language is written in it's own language
Is java language written in c language ?
you will find answer to your question on this link
this forum is about sun java developers network
http://forum.java.sun.com/thread.jspa?th...
Reply:Yes. The Java Virtual Machine (or JVM) is written in C.
Without out C it would have been much slower.
potential breakup song
it is perfectly possible to write an OO language with a non-OO language. Since OO is only a concept where Variables are stored in objects i.e stored in a structured way. It is however almost impossible to write OO-ly in that non-OO language itself.
Note: it's class however is written on Java. Classes are reusable code that is written by the language developer to increase functionality. Most class for a language is written in it's own language
Is java language written in c language ?
you will find answer to your question on this link
this forum is about sun java developers network
http://forum.java.sun.com/thread.jspa?th...
Reply:Yes. The Java Virtual Machine (or JVM) is written in C.
Without out C it would have been much slower.
potential breakup song
Why is it c-language important adove all language?
Numerous operating systems, such as Unix, Linux and Windows kernel are all written in C. C was designed to be close to the hardware and still portable with recompile to allow writing system code.
In addition to being at the right place in the right time, it's linking and call systems are easy to reproduce in other languages. This allows other languages to use libraries written in C. It's common to see other languages like Java, VB and Fortran to have the ability to call a C library (such as a DLL in Windows or .so in Unix).
Even today in the embedded field, it's not unusual to have a C compiler as your only language option. C doesn't need a VM or any lower level library to work. It compiles straight to machine code and can be used on the most resource limited projects.
Now, this isn't to say that C is the best language in all uses. In fact it is showing it's age. For common projects on a desktop with an OS where using a VM is a reasonable option I would say C is not the best choice. I would strongly suggest a newer language such as Java, C# or Python, mainly for their extensive libraries. No sense re-inventing the wheel.
Why is it c-language important adove all language?
Mikaljr was right. C was invented in the 60 years of 20th century and many nowadays systems or tools is developed or based on C. And compare to other advanced language such as Java, C provide envionment to let programmers take a direct operation on machine.So it's still irreplaceable.
Reply:Apparently it is more important than English, too.
To answer your question, the majority of systems in existence are written in C, including the military and communications.
It is important for no other reason than it is still prevalent.
Reply:Haha... it is just because most everything nowadays is written in C, thats all.
In addition to being at the right place in the right time, it's linking and call systems are easy to reproduce in other languages. This allows other languages to use libraries written in C. It's common to see other languages like Java, VB and Fortran to have the ability to call a C library (such as a DLL in Windows or .so in Unix).
Even today in the embedded field, it's not unusual to have a C compiler as your only language option. C doesn't need a VM or any lower level library to work. It compiles straight to machine code and can be used on the most resource limited projects.
Now, this isn't to say that C is the best language in all uses. In fact it is showing it's age. For common projects on a desktop with an OS where using a VM is a reasonable option I would say C is not the best choice. I would strongly suggest a newer language such as Java, C# or Python, mainly for their extensive libraries. No sense re-inventing the wheel.
Why is it c-language important adove all language?
Mikaljr was right. C was invented in the 60 years of 20th century and many nowadays systems or tools is developed or based on C. And compare to other advanced language such as Java, C provide envionment to let programmers take a direct operation on machine.So it's still irreplaceable.
Reply:Apparently it is more important than English, too.
To answer your question, the majority of systems in existence are written in C, including the military and communications.
It is important for no other reason than it is still prevalent.
Reply:Haha... it is just because most everything nowadays is written in C, thats all.
Which would you prefer? Java Language or C/C++ Language? Why?
Im a computer Science student and i was just wondering which of those 2 languages appeal most to you guys. I wanted to know so I can focus more on whichever you would prefer. So please express your side. thanks.
Which would you prefer? Java Language or C/C++ Language? Why?
Java was the choice language to teach in at the college i graduated from. Java is definitely a cool language but there are nuances. You will start developing GUI interfaces quicker through learning java then you will with C or C++. C++ has it's positives as well. It is a quicker language to execute code in than Java, although java touts to be quicker due to byte code compiling. I would speak with your advisor at college and see what language they use primarily.
Reply:Java
cuz more simple, and this effect even to ur carrier, so java do what c and c++ do, except very very very special cases
Reply:This is a tricky descision.With you have the ability to form a true executable (in machine code) for whatever operating system you're using. But with Java you have a larger cross platform ability. C will also gain more speed then Java will but Java may be found easier to program in.
Reply:The language I prefer is Java because it is more robust and platform adaptable.
Reply:which you think is best because its depands lots on ur intreast
Reply:C++. Eventough it is really challenging, nothing is impossible with C++. In fact Windows was designed using C++. Java is too case sensitive (C++ is also case sensitive but in this everything is in small letter unlike in Java)
Reply:mainly i suggest java.
you say that say about which lang. c++ or java prefer.but sir/madam you go to java after learn c++.so mostofly first you get all concept of c++ then go to java.
however java is more useful all ways. it's mainly used in web technology.because it is plat form indepedently.so beteer learn java.
Reply:as far as i concern c++ is more efficient than c. but both Java and c++ are useful in diffrent ways. most of the web applications and mobile sofwares are written by Java. but c++ is a good language to write system programs. but a greater positive oint about java is that those programs which are written by Java can be use in diffrent machines.
Which would you prefer? Java Language or C/C++ Language? Why?
Java was the choice language to teach in at the college i graduated from. Java is definitely a cool language but there are nuances. You will start developing GUI interfaces quicker through learning java then you will with C or C++. C++ has it's positives as well. It is a quicker language to execute code in than Java, although java touts to be quicker due to byte code compiling. I would speak with your advisor at college and see what language they use primarily.
Reply:Java
cuz more simple, and this effect even to ur carrier, so java do what c and c++ do, except very very very special cases
Reply:This is a tricky descision.With you have the ability to form a true executable (in machine code) for whatever operating system you're using. But with Java you have a larger cross platform ability. C will also gain more speed then Java will but Java may be found easier to program in.
Reply:The language I prefer is Java because it is more robust and platform adaptable.
Reply:which you think is best because its depands lots on ur intreast
Reply:C++. Eventough it is really challenging, nothing is impossible with C++. In fact Windows was designed using C++. Java is too case sensitive (C++ is also case sensitive but in this everything is in small letter unlike in Java)
Reply:mainly i suggest java.
you say that say about which lang. c++ or java prefer.but sir/madam you go to java after learn c++.so mostofly first you get all concept of c++ then go to java.
however java is more useful all ways. it's mainly used in web technology.because it is plat form indepedently.so beteer learn java.
Reply:as far as i concern c++ is more efficient than c. but both Java and c++ are useful in diffrent ways. most of the web applications and mobile sofwares are written by Java. but c++ is a good language to write system programs. but a greater positive oint about java is that those programs which are written by Java can be use in diffrent machines.
C language interview question +pdf?
Well buddy
i dint get your question
but if u really need interview questions then check out the link in which there are several interview based questions
covering a vast area of subjects which includes c language also
Try it
http://www.freewebs.com/mjitians/links.h...
Thank U
C language interview question +pdf?
what is ur question buddy??well from wat i can say its a name of a file....
i dint get your question
but if u really need interview questions then check out the link in which there are several interview based questions
covering a vast area of subjects which includes c language also
Try it
http://www.freewebs.com/mjitians/links.h...
Thank U
C language interview question +pdf?
what is ur question buddy??well from wat i can say its a name of a file....
C language problem...?
if a 5 digit no. is input thru keyboard, write a program to print a new no. by adding 1 to each of its digits.
C language problem...?
int a;
. . .
scanf("%d", %26amp;a);
printf("%d", a + 11111);
. . .
Reply:u shud create an array that is of length 5 and once the user inputs it create a loop that will cycle to each array and add 1 to each member of the array
Reply:#include %26lt;stdio.h%26gt;
#define MAX 5
int main(int argc,char *argv[]){
int cnt;
int num[MAX];
for(cnt =0; cnt %26lt; MAX; cnt++){
printf("\nEnter number: ");
scanf("%d",%26amp;num[cnt]);
}
for(cnt =0; cnt %26lt; MAX; cnt++)
printf("\nNumber %d is %d",cnt+1,num[cnt]+1);
return 0;
}
is this your homework?
love song
C language problem...?
int a;
. . .
scanf("%d", %26amp;a);
printf("%d", a + 11111);
. . .
Reply:u shud create an array that is of length 5 and once the user inputs it create a loop that will cycle to each array and add 1 to each member of the array
Reply:#include %26lt;stdio.h%26gt;
#define MAX 5
int main(int argc,char *argv[]){
int cnt;
int num[MAX];
for(cnt =0; cnt %26lt; MAX; cnt++){
printf("\nEnter number: ");
scanf("%d",%26amp;num[cnt]);
}
for(cnt =0; cnt %26lt; MAX; cnt++)
printf("\nNumber %d is %d",cnt+1,num[cnt]+1);
return 0;
}
is this your homework?
love song
Friday, May 21, 2010
C language help?
How do you do this one with FOR loop and how with DO...WHILE loop?
*
**
***
****
Until ten
C language help?
#include %26lt;iostream%26gt;
using namespace std;
int main()
{
int i,j;
for(i=1;i%26lt;=10;i++)
{
for(j=1;j%26lt;i;j++)
{
cout%26lt;%26lt;"*";
}
cout%26lt;%26lt;"\n";
}
return 0;
}
Reply:i don't if it is right...
x = 0
while (x %26lt; 11)
{
do
y=x
while (y %26gt; 0)
{
do
printf (" * \n");
}
printf ("\n");
printf (" * ");
}
Reply:#include %26lt;stdio.h%26gt;
#include %26lt;string.h%26gt;
printf("For Loop\n");
int i ;
char stars1[11] = "*";
for (i = 0; i %26lt; 10; i++){
printf("%s\n",stars1); //print the char array of stars
strcat(stars1,"*"); //concatenate to our initial string one more star
}
i = 0
char stars2[11]="*";
printf("While\n");
do{
printf("%s\n",stars2);
strcat(stars2,"*");
i++;
}while(i %26lt; 10);
+++++++++++++++++++++++++++++++++++++
or you can do this
int i = 0;
int j = 0;
for(i = 0; i %26lt; 10;i++){
for (j = 0; j %26lt; (i+1); j++){
printf("%s","*");
}
printf("\n");
}
i = 0;
j = 0;
do{
do{
printf("%s","*");
j++;
}while(j %26lt; (i+1));
j = 0;
i++;
printf("\n");
}while(i %26lt; 10);
Good Luck
*
**
***
****
Until ten
C language help?
#include %26lt;iostream%26gt;
using namespace std;
int main()
{
int i,j;
for(i=1;i%26lt;=10;i++)
{
for(j=1;j%26lt;i;j++)
{
cout%26lt;%26lt;"*";
}
cout%26lt;%26lt;"\n";
}
return 0;
}
Reply:i don't if it is right...
x = 0
while (x %26lt; 11)
{
do
y=x
while (y %26gt; 0)
{
do
printf (" * \n");
}
printf ("\n");
printf (" * ");
}
Reply:#include %26lt;stdio.h%26gt;
#include %26lt;string.h%26gt;
printf("For Loop\n");
int i ;
char stars1[11] = "*";
for (i = 0; i %26lt; 10; i++){
printf("%s\n",stars1); //print the char array of stars
strcat(stars1,"*"); //concatenate to our initial string one more star
}
i = 0
char stars2[11]="*";
printf("While\n");
do{
printf("%s\n",stars2);
strcat(stars2,"*");
i++;
}while(i %26lt; 10);
+++++++++++++++++++++++++++++++++++++
or you can do this
int i = 0;
int j = 0;
for(i = 0; i %26lt; 10;i++){
for (j = 0; j %26lt; (i+1); j++){
printf("%s","*");
}
printf("\n");
}
i = 0;
j = 0;
do{
do{
printf("%s","*");
j++;
}while(j %26lt; (i+1));
j = 0;
i++;
printf("\n");
}while(i %26lt; 10);
Good Luck
C language expression?
s=++a + a++ + --a + a--;(a=10)
its answer is 40 how.
why a is not ++a =11 or --a =9. explain it .
C language expression?
S=40, a=10 after execution of the step
Explanation:
rules:
1) post fix ++ and -- have more precedence than prefix ++ and --.
2) postfix ++ and -- have associativity from left to right.
3) Prefix ++ and -- have associativity from right to left.
4) + has the lowest precedence among them all
now lets call the terms ++a as t1
a++ as t2
--a as t3
a-- as t4.
So the expression is t1+t2+t3+t4, right?
now
the evaluation will be done in this order
1) t2 (because of rule 1 and 2)
t2=a++ and a =10 so after execution t2=10 and s=11
note: i hope u know that a postfix ++ assigns the value first and then increments the variable, ie
for x=3,
s=x++ will do this, assign the value of x(3) to s and then increment x so s becomes 3 and x becomes 4.
prefix ++ and -- increment or decrement the value first and then assign it .
2) t4 (because of rule 1 and 2) so t4=11, a=10
3) t3 (because of rule 3) so t3=9, a=9
4) t1 (because of rule 3) so t1=10, a=10
in the end t1+t2+t3+t4 = 10+10+9+11 = 40 and a =10
Reply:posfix expression has more preceedence rather then prefix,
so postfix is solved first,
that is why ++a is not equal to 11 as a++=11 and then ++a=12
Reply:this is how i understand it.
+ has more precedence over ++ and -- so, a+a is evaluated first.
in both the cases and therefore it becomes 20+20 = 40.
i have to admit that it isnt very clear.
Reply:see it goes like this
s=++a+a+++--a+a--
so, s=++10+10+++--10+10--
therefore,++=+
+-=+,so cancle those two+%26amp;-
so u get only +
then +10
and then the last -- means +; ie --=+
therefore,s=+10+10+10+10
s=40
it is not nessary to put the last +sign.
i hope u got it
good luck
Reply:its a wrong answer
Reply:yaa
++a= 11
a++=10
--a=9
a--=10
so 11+10+9+10=40
C execute and save its value after whole expression
its answer is 40 how.
why a is not ++a =11 or --a =9. explain it .
C language expression?
S=40, a=10 after execution of the step
Explanation:
rules:
1) post fix ++ and -- have more precedence than prefix ++ and --.
2) postfix ++ and -- have associativity from left to right.
3) Prefix ++ and -- have associativity from right to left.
4) + has the lowest precedence among them all
now lets call the terms ++a as t1
a++ as t2
--a as t3
a-- as t4.
So the expression is t1+t2+t3+t4, right?
now
the evaluation will be done in this order
1) t2 (because of rule 1 and 2)
t2=a++ and a =10 so after execution t2=10 and s=11
note: i hope u know that a postfix ++ assigns the value first and then increments the variable, ie
for x=3,
s=x++ will do this, assign the value of x(3) to s and then increment x so s becomes 3 and x becomes 4.
prefix ++ and -- increment or decrement the value first and then assign it .
2) t4 (because of rule 1 and 2) so t4=11, a=10
3) t3 (because of rule 3) so t3=9, a=9
4) t1 (because of rule 3) so t1=10, a=10
in the end t1+t2+t3+t4 = 10+10+9+11 = 40 and a =10
Reply:posfix expression has more preceedence rather then prefix,
so postfix is solved first,
that is why ++a is not equal to 11 as a++=11 and then ++a=12
Reply:this is how i understand it.
+ has more precedence over ++ and -- so, a+a is evaluated first.
in both the cases and therefore it becomes 20+20 = 40.
i have to admit that it isnt very clear.
Reply:see it goes like this
s=++a+a+++--a+a--
so, s=++10+10+++--10+10--
therefore,++=+
+-=+,so cancle those two+%26amp;-
so u get only +
then +10
and then the last -- means +; ie --=+
therefore,s=+10+10+10+10
s=40
it is not nessary to put the last +sign.
i hope u got it
good luck
Reply:its a wrong answer
Reply:yaa
++a= 11
a++=10
--a=9
a--=10
so 11+10+9+10=40
C execute and save its value after whole expression
How do you pronounce the name of the programming language 'Visual C#'? is it "sea hash"?
How is this language related to C, C+ and C++?
How do you pronounce the name of the programming language 'Visual C#'? is it "sea hash"?
It is pronounced Visual C Sharp.
Reply:C# is read as : sea sharp. C+ doesn't exist. C++ is the step up frm C. C# has various differences 2 C++ %26amp; personally I find it a lot easier 2 understand that C++. (Maybe 2 do with my crap @ explaining teacher who happens 2 b a DR!!! in Comp.Eng --(((( )
Reply:C Sharp is the answer.
Reply:The language is called "sea sharp", which is an ECMA standard (1). Although Microsoft invented the language, there are other implementations of it. Visual C# is Microsoft's implementation of the C# language.
It is related to other C languages (C and C++) by the fact that it uses the C syntax. Also Microsoft wants to replace the previous dominate languages of C, C++ and Java (also a C syntax language) with C#, so they gave it a name that made it look like the predecessor to C and C++.
The difference between C and C++ was the move from procedural or functional programming to object orientated programming. The big difference with C# is the removal of pointers and working within the .NET framework. There is no use of C# outside of the .NET CLI (Common Language Infrastructure), which is also an ECMA standard (2).
Keep in mind that Microsoft isn't the only one to implement that framework though. There is a number of other implementations, with the most notable one being MONO (3), which is a cross platform open source implementation.
Interestingly, how C++ got its name is that in the C language there is a ++ operator that takes the value of a variable, increases it by one, and then uses that value. So to write C++ is to say C = C + 1.
So Microsoft took C++ and they moved the first plus up a little bit, and the second plus down a little bit, then they moved them closer together so they overlapped. If you clean that up then you have the # symbol in C#.
So depending on why you wanted to know all this that is a pretty good basis of trivial knowledge.
Reply:sea sharp
c+ and c++ are variations of the c porgramming language
Reply:sea sharp as in the muscal #
Reply:It is called MS Visual C Sharp (pronounced see-sharp). There is no language called C+.
C# is a brand new language that actually has its roots in JAVA!! This language is Microsoft's answer to Sun's J2EE technologies. C and C++ are lower level languages that allow you greater control over you code than C#, but they are both more difficult to work with.
C#'s claim to fame is that once you learn it, programming in VB.Net and J#.Net is easy.
Reply:if you want to be a real geek then it is "see octothorpe" that little symbol is called an octothorpe because the designers thoughts it kinda looked like a town surrounded by eight fields. thorpe being an old english name for town
Reply:or just do what Smiddy does and make a kind of hacking cough sound after the C part...
Boss loves that.
Reply:it is better called as C Sharp
and there is no language called C+
C# is more adanced than C and C++ with lot many libraries integrated and is pure object oriented language.
Reply:It's "See Sharp". Never heard of language C+. And it's very much different than C and C++.
Reply:see sharp
How do you pronounce the name of the programming language 'Visual C#'? is it "sea hash"?
It is pronounced Visual C Sharp.
Reply:C# is read as : sea sharp. C+ doesn't exist. C++ is the step up frm C. C# has various differences 2 C++ %26amp; personally I find it a lot easier 2 understand that C++. (Maybe 2 do with my crap @ explaining teacher who happens 2 b a DR!!! in Comp.Eng --(((( )
Reply:C Sharp is the answer.
Reply:The language is called "sea sharp", which is an ECMA standard (1). Although Microsoft invented the language, there are other implementations of it. Visual C# is Microsoft's implementation of the C# language.
It is related to other C languages (C and C++) by the fact that it uses the C syntax. Also Microsoft wants to replace the previous dominate languages of C, C++ and Java (also a C syntax language) with C#, so they gave it a name that made it look like the predecessor to C and C++.
The difference between C and C++ was the move from procedural or functional programming to object orientated programming. The big difference with C# is the removal of pointers and working within the .NET framework. There is no use of C# outside of the .NET CLI (Common Language Infrastructure), which is also an ECMA standard (2).
Keep in mind that Microsoft isn't the only one to implement that framework though. There is a number of other implementations, with the most notable one being MONO (3), which is a cross platform open source implementation.
Interestingly, how C++ got its name is that in the C language there is a ++ operator that takes the value of a variable, increases it by one, and then uses that value. So to write C++ is to say C = C + 1.
So Microsoft took C++ and they moved the first plus up a little bit, and the second plus down a little bit, then they moved them closer together so they overlapped. If you clean that up then you have the # symbol in C#.
So depending on why you wanted to know all this that is a pretty good basis of trivial knowledge.
Reply:sea sharp
c+ and c++ are variations of the c porgramming language
Reply:sea sharp as in the muscal #
Reply:It is called MS Visual C Sharp (pronounced see-sharp). There is no language called C+.
C# is a brand new language that actually has its roots in JAVA!! This language is Microsoft's answer to Sun's J2EE technologies. C and C++ are lower level languages that allow you greater control over you code than C#, but they are both more difficult to work with.
C#'s claim to fame is that once you learn it, programming in VB.Net and J#.Net is easy.
Reply:if you want to be a real geek then it is "see octothorpe" that little symbol is called an octothorpe because the designers thoughts it kinda looked like a town surrounded by eight fields. thorpe being an old english name for town
Reply:or just do what Smiddy does and make a kind of hacking cough sound after the C part...
Boss loves that.
Reply:it is better called as C Sharp
and there is no language called C+
C# is more adanced than C and C++ with lot many libraries integrated and is pure object oriented language.
Reply:It's "See Sharp". Never heard of language C+. And it's very much different than C and C++.
Reply:see sharp
C LANGUAGE: How do I use the kbhit function to make a snake program?
Just the simplest way possible. I'm a high school student and it doesnt need to be great. Thanks.
C LANGUAGE: How do I use the kbhit function to make a snake program?
kbhit() is not a standard C library function - I checked, it is Borland-specific. This means if you use it your program will not be portable to other C compilers.
It isn't that hard. kbhit() returns non-zero if a key is waiting in the buffer. So, you need something like the following:
for (;;) {
...if (kbhit()) {
......changeDirection(%26amp;state);
...}
...if (!move(%26amp;state))break;
...delay(%26amp;state);
}
where state is a structure that contains your state information (location, size, speed, score...), move() moves the snake, and delay() waits a short time to control the snake's speed.
In changeDirection() you need to use getchar() or something to read the command, and then update the state structure to reflect the new direction.
garden flowers
C LANGUAGE: How do I use the kbhit function to make a snake program?
kbhit() is not a standard C library function - I checked, it is Borland-specific. This means if you use it your program will not be portable to other C compilers.
It isn't that hard. kbhit() returns non-zero if a key is waiting in the buffer. So, you need something like the following:
for (;;) {
...if (kbhit()) {
......changeDirection(%26amp;state);
...}
...if (!move(%26amp;state))break;
...delay(%26amp;state);
}
where state is a structure that contains your state information (location, size, speed, score...), move() moves the snake, and delay() waits a short time to control the snake's speed.
In changeDirection() you need to use getchar() or something to read the command, and then update the state structure to reflect the new direction.
garden flowers
C language help!?
what is difference bt
void main(int)
int main()
and some more
please someone explain various types
i want to know how each function statements effects the program
C language help!?
void main(int) - is the signature of a program that takes an integer as an argument and does not return anything.
int main() - is the signature of a program that takes zero arguments and returns an integer.
I'm referring to the signature of the main function as the signature of the program.
You can get more info at www.cprogramming.com/tutorial.html
Reply:int - integer
void - no value
string - string
double - real number
float - real number
type funtionName(arguments)
type is the return type. A value of that type must be returned by the function, unless the return type is void. In this case no value needs to be returned.
functionName is self explanatory.
arguments would be the arguments supplied to the function and hence can be used within the function. Their scope is only within the function unless an argument is passed by reference.
Reply:All of the above is true, but main() is special.
main is a function that returns int.
main also takes, as arguments, a count of the arguments passed it, and each of those arguments (each is a pointer to character)
main looks like this:
int main(int argc, char **argv)
where argv is an array of pointers to character.
or, alternately:
int main(int argc, char *argv[])
(the arguments don't have to be called argc and argv... that's just a convention. This is also valid:
int main(int count, char *arguments[])
or
int main(int how_many_arguments_we_have, char *the_arguments_we_got[])
)
void main(int)
int main()
and some more
please someone explain various types
i want to know how each function statements effects the program
C language help!?
void main(int) - is the signature of a program that takes an integer as an argument and does not return anything.
int main() - is the signature of a program that takes zero arguments and returns an integer.
I'm referring to the signature of the main function as the signature of the program.
You can get more info at www.cprogramming.com/tutorial.html
Reply:int - integer
void - no value
string - string
double - real number
float - real number
type funtionName(arguments)
type is the return type. A value of that type must be returned by the function, unless the return type is void. In this case no value needs to be returned.
functionName is self explanatory.
arguments would be the arguments supplied to the function and hence can be used within the function. Their scope is only within the function unless an argument is passed by reference.
Reply:All of the above is true, but main() is special.
main is a function that returns int.
main also takes, as arguments, a count of the arguments passed it, and each of those arguments (each is a pointer to character)
main looks like this:
int main(int argc, char **argv)
where argv is an array of pointers to character.
or, alternately:
int main(int argc, char *argv[])
(the arguments don't have to be called argc and argv... that's just a convention. This is also valid:
int main(int count, char *arguments[])
or
int main(int how_many_arguments_we_have, char *the_arguments_we_got[])
)
C language program for deadline scheduling?
please be more specific,about what type of scheduling u want.If possible explain it with an example.
The C programme will not be be that difficult.
calling cards
The C programme will not be be that difficult.
calling cards
C language help needed ? HELP ME ?
I am trying to make a program to calculate compound interest ?
Formula is - A=P(1+R/100)N
Here n is power.
or you can get formula on http://www.viacorp.com/compound_interest...
Can you help me to make a program.
But I cannot make a command for N.
I am at inserting power to programme.
C language help needed ? HELP ME ?
A = P(1 + r)^n
First your save P(1+r) into A
Then multiple A to itself n times (this is usually a loop).
Or just use the POW function:
pow (x,y)
x = base
y = power
Reply:This looks OK. However, if it's giving complete garbage as output, this may be because you forgot to put
#include %26lt;math.h%26gt;
at the top of your file. In C, if a function's prototype isn't declared before you use it, the return type and all the parameters' types default to int.
If it's producing results that are almost right, check your input. Where are the values of p and r coming from? If you're using scanf to get them, check your format string.
Reply:This C program computes compound interest using the FOR loop.
A person invests $500.00 in a saving account yielding 3% of interest. Assuming that all interest is left on deposit in the account, calculate and print the amount of money in the account at the end of each year for 10 years using the following equation:
a = p(1+r)n
where p is the original amount invested
r is the annual interest rate
n is the number of year
a is the amount on deposit at the end of the nth year
======================================...
/* Calculating compound interest*/
#include %26lt;stdio.h%26gt;
#include %26lt;math.h%26gt;
/* function main begins program execution */
int main()
{
double amount; /* amount on deposit */
double principal = 500.0; /* starting principal */
double rate = 0.03; /* annual interest rate */
int year; /* year counter */
/* output table column head */
printf( "%4s%21s\n", "Year", "Amount on deposit" );
/* calculate amount on deposit for each of ten years */
for ( year = 1; year %26lt;= 10; year++ ) {
/* calculate new amount for specified year */
amount = principal * pow( 1.0 + rate, year );
/* output one table row */
printf( "%4d%21.2f\n", year, amount );
} /* end for */
return 0; /* indicate program ended successfully */
}
======================================...
Good luck 2 u!
Reply:To use exponents in C, you use the function:
pow (x,y) where x is the base and y is the exponent you want to raise it to.
In your example, this would be:
A = pow (P*(1+R/100), N);
Enjoy!
Formula is - A=P(1+R/100)N
Here n is power.
or you can get formula on http://www.viacorp.com/compound_interest...
Can you help me to make a program.
But I cannot make a command for N.
I am at inserting power to programme.
C language help needed ? HELP ME ?
A = P(1 + r)^n
First your save P(1+r) into A
Then multiple A to itself n times (this is usually a loop).
Or just use the POW function:
pow (x,y)
x = base
y = power
Reply:This looks OK. However, if it's giving complete garbage as output, this may be because you forgot to put
#include %26lt;math.h%26gt;
at the top of your file. In C, if a function's prototype isn't declared before you use it, the return type and all the parameters' types default to int.
If it's producing results that are almost right, check your input. Where are the values of p and r coming from? If you're using scanf to get them, check your format string.
Reply:This C program computes compound interest using the FOR loop.
A person invests $500.00 in a saving account yielding 3% of interest. Assuming that all interest is left on deposit in the account, calculate and print the amount of money in the account at the end of each year for 10 years using the following equation:
a = p(1+r)n
where p is the original amount invested
r is the annual interest rate
n is the number of year
a is the amount on deposit at the end of the nth year
======================================...
/* Calculating compound interest*/
#include %26lt;stdio.h%26gt;
#include %26lt;math.h%26gt;
/* function main begins program execution */
int main()
{
double amount; /* amount on deposit */
double principal = 500.0; /* starting principal */
double rate = 0.03; /* annual interest rate */
int year; /* year counter */
/* output table column head */
printf( "%4s%21s\n", "Year", "Amount on deposit" );
/* calculate amount on deposit for each of ten years */
for ( year = 1; year %26lt;= 10; year++ ) {
/* calculate new amount for specified year */
amount = principal * pow( 1.0 + rate, year );
/* output one table row */
printf( "%4d%21.2f\n", year, amount );
} /* end for */
return 0; /* indicate program ended successfully */
}
======================================...
Good luck 2 u!
Reply:To use exponents in C, you use the function:
pow (x,y) where x is the base and y is the exponent you want to raise it to.
In your example, this would be:
A = pow (P*(1+R/100), N);
Enjoy!
C language help?
How do you do this one with FOR loop and how with DO...WHILE loop?
*
**
***
****
Until ten
C language help?
#include %26lt;iostream%26gt;
using namespace std;
int main()
{
int i,j;
for(i=1;i%26lt;=10;i++)
{
for(j=1;j%26lt;i;j++)
{
cout%26lt;%26lt;"*";
}
cout%26lt;%26lt;"\n";
}
return 0;
}
Reply:i don't if it is right...
x = 0
while (x %26lt; 11)
{
do
y=x
while (y %26gt; 0)
{
do
printf (" * \n");
}
printf ("\n");
printf (" * ");
}
Reply:#include %26lt;stdio.h%26gt;
#include %26lt;string.h%26gt;
printf("For Loop\n");
int i ;
char stars1[11] = "*";
for (i = 0; i %26lt; 10; i++){
printf("%s\n",stars1); //print the char array of stars
strcat(stars1,"*"); //concatenate to our initial string one more star
}
i = 0
char stars2[11]="*";
printf("While\n");
do{
printf("%s\n",stars2);
strcat(stars2,"*");
i++;
}while(i %26lt; 10);
+++++++++++++++++++++++++++++++++++++
or you can do this
int i = 0;
int j = 0;
for(i = 0; i %26lt; 10;i++){
for (j = 0; j %26lt; (i+1); j++){
printf("%s","*");
}
printf("\n");
}
i = 0;
j = 0;
do{
do{
printf("%s","*");
j++;
}while(j %26lt; (i+1));
j = 0;
i++;
printf("\n");
}while(i %26lt; 10);
Good Luck
*
**
***
****
Until ten
C language help?
#include %26lt;iostream%26gt;
using namespace std;
int main()
{
int i,j;
for(i=1;i%26lt;=10;i++)
{
for(j=1;j%26lt;i;j++)
{
cout%26lt;%26lt;"*";
}
cout%26lt;%26lt;"\n";
}
return 0;
}
Reply:i don't if it is right...
x = 0
while (x %26lt; 11)
{
do
y=x
while (y %26gt; 0)
{
do
printf (" * \n");
}
printf ("\n");
printf (" * ");
}
Reply:#include %26lt;stdio.h%26gt;
#include %26lt;string.h%26gt;
printf("For Loop\n");
int i ;
char stars1[11] = "*";
for (i = 0; i %26lt; 10; i++){
printf("%s\n",stars1); //print the char array of stars
strcat(stars1,"*"); //concatenate to our initial string one more star
}
i = 0
char stars2[11]="*";
printf("While\n");
do{
printf("%s\n",stars2);
strcat(stars2,"*");
i++;
}while(i %26lt; 10);
+++++++++++++++++++++++++++++++++++++
or you can do this
int i = 0;
int j = 0;
for(i = 0; i %26lt; 10;i++){
for (j = 0; j %26lt; (i+1); j++){
printf("%s","*");
}
printf("\n");
}
i = 0;
j = 0;
do{
do{
printf("%s","*");
j++;
}while(j %26lt; (i+1));
j = 0;
i++;
printf("\n");
}while(i %26lt; 10);
Good Luck
C language Help (dynamic multidimensional array)?
i have this array:
int array[unknown1][unknown2];
how can i place the value of 'unknown1' and 'unknown2' from inputted data. using dynamic multidimensional array.
for example:
printf("Input row size: ");
scanf("%d",%26amp;s1);
printf("Input column size: ");
scanf("%d",%26amp;s2);
using dynamic multidimensional array..
how can i transfer the value of s1 to unknown1 and s2 to unknown2..
really need your help.. thanks!
C language Help (dynamic multidimensional array)?
Something like this:
int **myArray;
int s1,s2,i;
printf("Input row size: ");
scanf("%d",%26amp;s1);
printf("Input column size: ");
scanf("%d",%26amp;s2);
myArray[0] = malloc(s1*s2*sizeof(int));
if (myArray[0] != NULL ) {
for (i = 0;i%26lt;s1,i++) {
myArray[i] = (i * s2) + myArray[0];
}
}
myArray can then be used as normal
myArray[2][4] = 20;
int array[unknown1][unknown2];
how can i place the value of 'unknown1' and 'unknown2' from inputted data. using dynamic multidimensional array.
for example:
printf("Input row size: ");
scanf("%d",%26amp;s1);
printf("Input column size: ");
scanf("%d",%26amp;s2);
using dynamic multidimensional array..
how can i transfer the value of s1 to unknown1 and s2 to unknown2..
really need your help.. thanks!
C language Help (dynamic multidimensional array)?
Something like this:
int **myArray;
int s1,s2,i;
printf("Input row size: ");
scanf("%d",%26amp;s1);
printf("Input column size: ");
scanf("%d",%26amp;s2);
myArray[0] = malloc(s1*s2*sizeof(int));
if (myArray[0] != NULL ) {
for (i = 0;i%26lt;s1,i++) {
myArray[i] = (i * s2) + myArray[0];
}
}
myArray can then be used as normal
myArray[2][4] = 20;
C language help!?
what is difference bt
void main(int)
int main()
and some more
please someone explain various types
i want to know how each function statements effects the program
C language help!?
void main(int) - is the signature of a program that takes an integer as an argument and does not return anything.
int main() - is the signature of a program that takes zero arguments and returns an integer.
I'm referring to the signature of the main function as the signature of the program.
You can get more info at www.cprogramming.com/tutorial.html
Reply:int - integer
void - no value
string - string
double - real number
float - real number
type funtionName(arguments)
type is the return type. A value of that type must be returned by the function, unless the return type is void. In this case no value needs to be returned.
functionName is self explanatory.
arguments would be the arguments supplied to the function and hence can be used within the function. Their scope is only within the function unless an argument is passed by reference.
Reply:All of the above is true, but main() is special.
main is a function that returns int.
main also takes, as arguments, a count of the arguments passed it, and each of those arguments (each is a pointer to character)
main looks like this:
int main(int argc, char **argv)
where argv is an array of pointers to character.
or, alternately:
int main(int argc, char *argv[])
(the arguments don't have to be called argc and argv... that's just a convention. This is also valid:
int main(int count, char *arguments[])
or
int main(int how_many_arguments_we_have, char *the_arguments_we_got[])
)
pokemon cards
void main(int)
int main()
and some more
please someone explain various types
i want to know how each function statements effects the program
C language help!?
void main(int) - is the signature of a program that takes an integer as an argument and does not return anything.
int main() - is the signature of a program that takes zero arguments and returns an integer.
I'm referring to the signature of the main function as the signature of the program.
You can get more info at www.cprogramming.com/tutorial.html
Reply:int - integer
void - no value
string - string
double - real number
float - real number
type funtionName(arguments)
type is the return type. A value of that type must be returned by the function, unless the return type is void. In this case no value needs to be returned.
functionName is self explanatory.
arguments would be the arguments supplied to the function and hence can be used within the function. Their scope is only within the function unless an argument is passed by reference.
Reply:All of the above is true, but main() is special.
main is a function that returns int.
main also takes, as arguments, a count of the arguments passed it, and each of those arguments (each is a pointer to character)
main looks like this:
int main(int argc, char **argv)
where argv is an array of pointers to character.
or, alternately:
int main(int argc, char *argv[])
(the arguments don't have to be called argc and argv... that's just a convention. This is also valid:
int main(int count, char *arguments[])
or
int main(int how_many_arguments_we_have, char *the_arguments_we_got[])
)
pokemon cards
C language- why is it not printing a float, and tell me how to fix it?
main()
{
int num=4478;
float num2;
num2=num/100;
printf("%.2f ",num2);
}
C language- why is it not printing a float, and tell me how to fix it?
main()
{
int num=4478;
float num2;
num2=num/100;
printf("%4.2f ",(float)num2);
}
try this, this one is type conversion in stmt num2=num/100 you are formulating the integer value to float variable.
Reply:num2=(float)num/100; change this,,,,then u wil get the result properly
Reply:Any one of the numbers should be a floating point number to get the floating point result
You can change your program like this
main(){
int num=4478;
float num2=num/100.0;
printf("%.2f",num2);
}
{
int num=4478;
float num2;
num2=num/100;
printf("%.2f ",num2);
}
C language- why is it not printing a float, and tell me how to fix it?
main()
{
int num=4478;
float num2;
num2=num/100;
printf("%4.2f ",(float)num2);
}
try this, this one is type conversion in stmt num2=num/100 you are formulating the integer value to float variable.
Reply:num2=(float)num/100; change this,,,,then u wil get the result properly
Reply:Any one of the numbers should be a floating point number to get the floating point result
You can change your program like this
main(){
int num=4478;
float num2=num/100.0;
printf("%.2f",num2);
}
Subscribe to:
Posts (Atom)