Looking for a site that, even if barely getting you started, shows what command in C you can use to run windows commands.
Like in unix you can call execl("bin/ls","ls","0"); and that will run the ls command for you, and then some forks etc.
Does anyone know of a good tutorial on running windows commands in the C Language?
There are two ways to do this from C language.
system("command goes here") is the most compatible. It has less control as it spawns an intermediate cmd shell to start the program.
Linux/Unix has exec???() which can be used to start external processes.
For Windows there is a spawn() command with some variants like spawnv() or spawnvpe().
Check your compiler docs.
Reply:Check out this article
http://www.codeguru.com/cpp/w-p/system/a...
You can learn how to run commands as the current logged in user or any user !!!
Sunday, August 2, 2009
How do you check which operating system a program is using when you are programming in the C language?
I want my C program to be able to check which OS it is being run in so that it can use the appropriate shell commands
Also, in C, what is the Linux equivalent for the C command
system("cls");
?
Thanks
How do you check which operating system a program is using when you are programming in the C language?
I am unaware of any universal way to determine the OS. That said, it really shouldn't be that much of an impediment.
Since you have to compile for each OS anyway, you can always use the time honored #define. E.G.
#define WINDOWS
....
#ifdef WINDOWS
string Clear("cls");
#else
string Clear("clear");
#endif
....
system(Clear);
=========
Or if you are solely focused on some kind of cls command, this should work on most platforms:
void clearScreen()
{
printf("\033[2J\033[1;1H");
}
===========
If the system is POSIX conforming, you can use uname. This should work fine on unix, linux, and OSX though I am unsure of Windows support for POSIX these days.
From linux:
#include %26lt;sys/utsname.h%26gt;
int uname(struct utsname *buf);
===================
Finally, if you are in a position to administer your systems, you can always just create an environment variable OS=Whatever and then access the environment via getenv() or the 3rd parameter to main().
Reply:In linux you can use system("clear") to clear the screen. In my experience the 'C' libraries have different calls depending upon the operating system (system v, linux, C etc). It can be done my adding a static text segment at link time detailing the operating system.
A command you can use on unix system is 'uname -a' which gives detailed os information.
Also, in C, what is the Linux equivalent for the C command
system("cls");
?
Thanks
How do you check which operating system a program is using when you are programming in the C language?
I am unaware of any universal way to determine the OS. That said, it really shouldn't be that much of an impediment.
Since you have to compile for each OS anyway, you can always use the time honored #define. E.G.
#define WINDOWS
....
#ifdef WINDOWS
string Clear("cls");
#else
string Clear("clear");
#endif
....
system(Clear);
=========
Or if you are solely focused on some kind of cls command, this should work on most platforms:
void clearScreen()
{
printf("\033[2J\033[1;1H");
}
===========
If the system is POSIX conforming, you can use uname. This should work fine on unix, linux, and OSX though I am unsure of Windows support for POSIX these days.
From linux:
#include %26lt;sys/utsname.h%26gt;
int uname(struct utsname *buf);
===================
Finally, if you are in a position to administer your systems, you can always just create an environment variable OS=Whatever and then access the environment via getenv() or the 3rd parameter to main().
Reply:In linux you can use system("clear") to clear the screen. In my experience the 'C' libraries have different calls depending upon the operating system (system v, linux, C etc). It can be done my adding a static text segment at link time detailing the operating system.
A command you can use on unix system is 'uname -a' which gives detailed os information.
Do you know where can I download a free chat artificial intelligence program in C++ language?
I use Microsoft Visual C++ 6.0.
Answer only if you are sure please!
Thank you.
Do you know where can I download a free chat artificial intelligence program in C++ language?
I am absolutely sure, one hundred percent certain, without a doubt, that the best thing for you to do is search Google and SourceForge. If something along those lines exists, you will find it there.
Rawlyn.
potential breakup song
Answer only if you are sure please!
Thank you.
Do you know where can I download a free chat artificial intelligence program in C++ language?
I am absolutely sure, one hundred percent certain, without a doubt, that the best thing for you to do is search Google and SourceForge. If something along those lines exists, you will find it there.
Rawlyn.
potential breakup song
Can u please help me in implementing a hashed oct tree?
oct tree in C language using hashing?
can u please help me in implementing a hashed oct tree?
i need to writea code in C to implement a oct tree that will hash data structure.if u hav any idea......plz tell me.......
if u need any other details.....u plz ask....
i will give each and every detail....
Can u please help me in implementing a hashed oct tree?
oct tree in C language using hashing?
Hi,
you can try this code... For traversal
Traverse(Key_t key, int (*MAC)(hcell *),
void (*postf)(hcell *))
{
hcell *pp;
unsigned int child;
if ((pp=Find(key)) %26amp;%26amp; MAC(pp)) return;
key = KeyLshift(key, NDIM);
for (child = 0; child %26lt; (1%26lt;%26lt;NDIM); child++)
Traverse(KeyOrInt(key, child), MAC, postf);
postf(pp);
}
This code applies an arbitraryMACto determine whether
to continue traversing the children of a cell. If the children
are traversed, than another function, postf, is called upon
completion of the descendants. By appropriate choice of
the MAC and postf one can execute pre-order or post-against the MAC. If it passes the MAC, the corresponding
cell data is placed on the interaction list. If a daughter
fails the MAC, it is placed on the output walk list. After
the entire input list is processed the output walk list is
copied to the walk list and the process iterates. The process
terminates when there are no nodes remaining on the walk
list. This method has an advantage over a recursive traversal
in that there is an opportunity to do some vectorization of
the intermediate traversal steps, since there are generally a
fair number of nodes which are being tested at a time. It
also results in a final interaction list which can be passed
to a fully vectorized force calculation routine. The details
are too intricate to allow us to present real C code, so we
present the algorithm in pseudocode instead:
ListTraverse((*MAC)(hcell *))
{
copy root to walk_list;
while (!Empty(walk_list)) {
for (each item on walk_list) {
for (each daughter of item) {
if (MAC(daughter))
copy daughter to interact_list;
else
copy daughter to output_walk_list;
}
}
walk_list = output_walk_list;
}
}
When the traversal is complete, the interact_list
contains a vector of items that must undergo interactions
(according to the particular MAC). The interactions themselves
may be computed separately, so that code may be
vectorized and optimized independently of the tree traversal
method.
Thanks
Kiran
P.S. If you need anything u can contact me on mail or IM
i need to writea code in C to implement a oct tree that will hash data structure.if u hav any idea......plz tell me.......
if u need any other details.....u plz ask....
i will give each and every detail....
Can u please help me in implementing a hashed oct tree?
oct tree in C language using hashing?
Hi,
you can try this code... For traversal
Traverse(Key_t key, int (*MAC)(hcell *),
void (*postf)(hcell *))
{
hcell *pp;
unsigned int child;
if ((pp=Find(key)) %26amp;%26amp; MAC(pp)) return;
key = KeyLshift(key, NDIM);
for (child = 0; child %26lt; (1%26lt;%26lt;NDIM); child++)
Traverse(KeyOrInt(key, child), MAC, postf);
postf(pp);
}
This code applies an arbitraryMACto determine whether
to continue traversing the children of a cell. If the children
are traversed, than another function, postf, is called upon
completion of the descendants. By appropriate choice of
the MAC and postf one can execute pre-order or post-against the MAC. If it passes the MAC, the corresponding
cell data is placed on the interaction list. If a daughter
fails the MAC, it is placed on the output walk list. After
the entire input list is processed the output walk list is
copied to the walk list and the process iterates. The process
terminates when there are no nodes remaining on the walk
list. This method has an advantage over a recursive traversal
in that there is an opportunity to do some vectorization of
the intermediate traversal steps, since there are generally a
fair number of nodes which are being tested at a time. It
also results in a final interaction list which can be passed
to a fully vectorized force calculation routine. The details
are too intricate to allow us to present real C code, so we
present the algorithm in pseudocode instead:
ListTraverse((*MAC)(hcell *))
{
copy root to walk_list;
while (!Empty(walk_list)) {
for (each item on walk_list) {
for (each daughter of item) {
if (MAC(daughter))
copy daughter to interact_list;
else
copy daughter to output_walk_list;
}
}
walk_list = output_walk_list;
}
}
When the traversal is complete, the interact_list
contains a vector of items that must undergo interactions
(according to the particular MAC). The interactions themselves
may be computed separately, so that code may be
vectorized and optimized independently of the tree traversal
method.
Thanks
Kiran
P.S. If you need anything u can contact me on mail or IM
I would like to know how can i get project works based on c language.?
though i have not yet faced big projects , but i have succeeded in small things ,which have increased my confidence level a lot.I can do yet larger projects.Kindly suggest me some way keeping in heart, that i know only c %26amp; a very little of c++(not enough to do project works i believe .) please give me a greater job to do .I wish to face bigger challenges.
I would like to know how can i get project works based on c language.?
hey u wana take bigger projects
there r 2 why dont u try them
first of all i would like u suggest u dat shift to dot net platform
like visual c++ .NET
on visual c++.net do one thing and temme ASAP
1. build a software that will load a bmp or jpg file from ur disk and removes all color out of it except white... means that will make all colors black but white remains same
try this man
ciao
Reply:All you need to know if you are programming is syntax and structure... The best programs to write when learning a language, in my opinion, are :
#1 - Simple hello world application.
#2 - Simple I/O interface with a human, usually some form of calculator from a command line.
#3 - A network socket client which can connect to an open port and read a response.
#4 - A network server which can accept connections from your own client.
#5 - Applications #3 and #4 but multi-threaded
#6 - Applications #3,#4 and #5 but with a graphical user interface
Then work on adding debug and error handling to your applications... Once you've done all that you'll be sorted, network programming and sychronisation of multiple threads is as hard as it's going to get.
3D programming is different, but you do need to know all of the above to create 3D programs as they will be very usefull once you have a good 3D engine going.
One thing you should never do is assume you don't have anything left to learn... You never know everything.
I'm the creator of an on-line MMORPG and every time I sit down and start working on it I look at what I did previously and think of better ways to do things... It's always progressing and being improved.
Reply:Hi John,
often (for some of us), it's more motivating to work in a team. You could go to sourceforge.net and look for teams which need help with programming - some of the projects there are big, some are small, i'm sure you can find something. And if sourceforge.net is not enough, there's also savannah.gnu.org.
Reply:Hello John,
The best way to learn about succeeding in medium to large projects is by examining how such systems are built. ie. How is the complexity broken up, how are the files structured, how to use tools like Makefile etc.
In case you have access to Kerninghan and Pike's classic book on UNIX, there is a medium sized project mentioned towards the end on a calculator. It is a pretty good learning experience to go over it.
I would like to know how can i get project works based on c language.?
hey u wana take bigger projects
there r 2 why dont u try them
first of all i would like u suggest u dat shift to dot net platform
like visual c++ .NET
on visual c++.net do one thing and temme ASAP
1. build a software that will load a bmp or jpg file from ur disk and removes all color out of it except white... means that will make all colors black but white remains same
try this man
ciao
Reply:All you need to know if you are programming is syntax and structure... The best programs to write when learning a language, in my opinion, are :
#1 - Simple hello world application.
#2 - Simple I/O interface with a human, usually some form of calculator from a command line.
#3 - A network socket client which can connect to an open port and read a response.
#4 - A network server which can accept connections from your own client.
#5 - Applications #3 and #4 but multi-threaded
#6 - Applications #3,#4 and #5 but with a graphical user interface
Then work on adding debug and error handling to your applications... Once you've done all that you'll be sorted, network programming and sychronisation of multiple threads is as hard as it's going to get.
3D programming is different, but you do need to know all of the above to create 3D programs as they will be very usefull once you have a good 3D engine going.
One thing you should never do is assume you don't have anything left to learn... You never know everything.
I'm the creator of an on-line MMORPG and every time I sit down and start working on it I look at what I did previously and think of better ways to do things... It's always progressing and being improved.
Reply:Hi John,
often (for some of us), it's more motivating to work in a team. You could go to sourceforge.net and look for teams which need help with programming - some of the projects there are big, some are small, i'm sure you can find something. And if sourceforge.net is not enough, there's also savannah.gnu.org.
Reply:Hello John,
The best way to learn about succeeding in medium to large projects is by examining how such systems are built. ie. How is the complexity broken up, how are the files structured, how to use tools like Makefile etc.
In case you have access to Kerninghan and Pike's classic book on UNIX, there is a medium sized project mentioned towards the end on a calculator. It is a pretty good learning experience to go over it.
Does anyone know to make a program which makes a very useful program that uses c++ language like turbo C?
Can anyone one help me?...i need your help very badly..example: a program w/c have a menu and ask user if wat is his choice....
or it plays a guessing game..or a program with any games..
Does anyone know to make a program which makes a very useful program that uses c++ language like turbo C?
the moment u mentioned a program that have a menu, i remembered an old exercise our prof. gave us about building a calculator in C.. it had to be like: make a menu that gives u options for which calculation operation u want (+ - * / ...), then enter ur first number then second number, and here u go with the result..
about a guessing game, try that the software creates a random integer number between 0 and 100.. u ll have to guess it, after each guess the computer tells u if it has to be higher, lower, or if it is the right answer..
happy coding :)
or it plays a guessing game..or a program with any games..
Does anyone know to make a program which makes a very useful program that uses c++ language like turbo C?
the moment u mentioned a program that have a menu, i remembered an old exercise our prof. gave us about building a calculator in C.. it had to be like: make a menu that gives u options for which calculation operation u want (+ - * / ...), then enter ur first number then second number, and here u go with the result..
about a guessing game, try that the software creates a random integer number between 0 and 100.. u ll have to guess it, after each guess the computer tells u if it has to be higher, lower, or if it is the right answer..
happy coding :)
Does anyone know to make a program which makes a very useful program that uses c++ language like turbo C?
Can anyone one help me?...i need your help very badly..example: a program w/c have a menu and ask user if wat is his choice....
or it plays a guessing game..or a program with any games..
I need the codes...kindly help me
Does anyone know to make a program which makes a very useful program that uses c++ language like turbo C?
i just answered it in ur last question, i ll copy paste it here:
"
the moment u mentioned a program that have a menu, i remembered an old exercise our prof. gave us about building a calculator in C.. it had to be like: make a menu that gives u options for which calculation operation u want (+ - * / ...), then enter ur first number then second number, and here u go with the result..
about a guessing game, try that the software creates a random integer number between 0 and 100.. u ll have to guess it, after each guess the computer tells u if it has to be higher, lower, or if it is the right answer..
happy coding :)
"
love song
or it plays a guessing game..or a program with any games..
I need the codes...kindly help me
Does anyone know to make a program which makes a very useful program that uses c++ language like turbo C?
i just answered it in ur last question, i ll copy paste it here:
"
the moment u mentioned a program that have a menu, i remembered an old exercise our prof. gave us about building a calculator in C.. it had to be like: make a menu that gives u options for which calculation operation u want (+ - * / ...), then enter ur first number then second number, and here u go with the result..
about a guessing game, try that the software creates a random integer number between 0 and 100.. u ll have to guess it, after each guess the computer tells u if it has to be higher, lower, or if it is the right answer..
happy coding :)
"
love song
What is the conversion specifier for a double data type in C language?
In C we are using "%d" for integer, "%f" for float values. Similarly what is to be used for a data of type double ?
What is the conversion specifier for a double data type in C language?
int x=5;
double y= (double)x ;
What is the conversion specifier for a double data type in C language?
int x=5;
double y= (double)x ;
How to use int86 statement or any other related statement in C language?
I want to use sound blasters,mouse, keyboard(some special characters like function keys etc..) in my C program. For that I want to use int86 related statements. Also send some information about preprocessors.
How to use int86 statement or any other related statement in C language?
Gopinath here is your link
http://www.google.co.uk/search?hl=en%26amp;q=u...
http://uk.search.yahoo.com/search?p=use+...
How to use int86 statement or any other related statement in C language?
Gopinath here is your link
http://www.google.co.uk/search?hl=en%26amp;q=u...
http://uk.search.yahoo.com/search?p=use+...
Can someone show me what this program would look like in C++ language?
Write a C++ program that adds all the even numbers from 1 to 40 except 4 and 10.
Use FOR loop or WHILE loop.
thanks!
Can someone show me what this program would look like in C++ language?
int i, total;
for(i=1;i%26lt;=40;i++){
if(i % 2) = 0 //the current number is divisble by 2
{
if(i != 4 %26amp;%26amp; i != 10){
total *= i;
}
}
loop
Something like that. I didn't compile it so the errors are free of charge.
Reply:int total=0;
for (int i=1; i%26lt;=40; i++)
{
if (((i % 2)==0) %26amp;%26amp; (i!=4) %26amp;%26amp; (i!=10)) total+=i;
}
Use FOR loop or WHILE loop.
thanks!
Can someone show me what this program would look like in C++ language?
int i, total;
for(i=1;i%26lt;=40;i++){
if(i % 2) = 0 //the current number is divisble by 2
{
if(i != 4 %26amp;%26amp; i != 10){
total *= i;
}
}
loop
Something like that. I didn't compile it so the errors are free of charge.
Reply:int total=0;
for (int i=1; i%26lt;=40; i++)
{
if (((i % 2)==0) %26amp;%26amp; (i!=4) %26amp;%26amp; (i!=10)) total+=i;
}
Simple Greedy Algorithms for a Weighted Interval Selection in JAVA or C++ language.?
i want a program in java or c++ for weighted interval selection .
this article is benefit :"Simple Algorithms for a Weighted Interval Selection Problem".
please notice that my program must use a greedy algorithm that announce in the article.even in article describe the algortihm.
my problem is a simple problem that m=1(mentioned in articl).
thank you.
Simple Greedy Algorithms for a Weighted Interval Selection in JAVA or C++ language.?
Plz check following link.
Reply:Please describe the problem in detail with sample input and output.
garden flowers
this article is benefit :"Simple Algorithms for a Weighted Interval Selection Problem".
please notice that my program must use a greedy algorithm that announce in the article.even in article describe the algortihm.
my problem is a simple problem that m=1(mentioned in articl).
thank you.
Simple Greedy Algorithms for a Weighted Interval Selection in JAVA or C++ language.?
Plz check following link.
Reply:Please describe the problem in detail with sample input and output.
garden flowers
How can we add two numbers without using a + operator in 'C' language?
this means Is there any built in functions in C for this operation?
How can we add two numbers without using a + operator in 'C' language?
private int Sum(int a, int b) {
int x = a ^ b;
while ((a %26amp; b) != 0) {
b = (a %26amp; b) %26lt;%26lt; 1;
a = x;
x = a ^ b;
}
return x;
}
private uint Product(uint a, uint b) {
uint p = 0;
while (b != 0) {
if ((b %26amp; 1) == 1) p = Sum(p, a);
a %26lt;%26lt;= 1;
b %26gt;%26gt;= 1;
}
return p;
}
Reply:its quite sinple why dont u use a-(-b)
Reply:Search for some function in ' math.h ' include file
How can we add two numbers without using a + operator in 'C' language?
private int Sum(int a, int b) {
int x = a ^ b;
while ((a %26amp; b) != 0) {
b = (a %26amp; b) %26lt;%26lt; 1;
a = x;
x = a ^ b;
}
return x;
}
private uint Product(uint a, uint b) {
uint p = 0;
while (b != 0) {
if ((b %26amp; 1) == 1) p = Sum(p, a);
a %26lt;%26lt;= 1;
b %26gt;%26gt;= 1;
}
return p;
}
Reply:its quite sinple why dont u use a-(-b)
Reply:Search for some function in ' math.h ' include file
Are you a programmer ?? Can you help me to explain this Program in C-language? (below)?
Program in C using one-dimensional array that determines the lowest value among five input values from the keyboard and prints the difference of each value from the lowest.
INPUT: 28643
OUTPUT:
5
4
2
1
#include %26lt;stdio.h%26gt;
main()
{
int inp[5],i,min;
printf("Enter 5 values--%26gt;");
for (i=0; i%26lt;5;i++)
{
scanf("%d", %26amp;inp[i]);
}
min=inp[0];
for (i=1; i%26lt;5; i++)
{
if (inp[i] %26lt; min)
min=inp[i];
}
printf("Minimm=%d\n",min);
for(i=0; i%26lt;5;i++)
{
printf("%d\n", inp[i]-min);
}
}
Are you a programmer ?? Can you help me to explain this Program in C-language? (below)?
I'm not sure what you're asking. The description at the beginning says exactly what it does. Or are you asking for line-by-line explanation?
calling cards
INPUT: 28643
OUTPUT:
5
4
2
1
#include %26lt;stdio.h%26gt;
main()
{
int inp[5],i,min;
printf("Enter 5 values--%26gt;");
for (i=0; i%26lt;5;i++)
{
scanf("%d", %26amp;inp[i]);
}
min=inp[0];
for (i=1; i%26lt;5; i++)
{
if (inp[i] %26lt; min)
min=inp[i];
}
printf("Minimm=%d\n",min);
for(i=0; i%26lt;5;i++)
{
printf("%d\n", inp[i]-min);
}
}
Are you a programmer ?? Can you help me to explain this Program in C-language? (below)?
I'm not sure what you're asking. The description at the beginning says exactly what it does. Or are you asking for line-by-line explanation?
calling cards
Can anyone give me a source code to generate a lexical analyser in c language.. it urgent!!?
a c prog to generate lexical analyser which gives tokens as output
Can anyone give me a source code to generate a lexical analyser in c language.. it urgent!!?
Someone left it too late to do their assignment....
Can anyone give me a source code to generate a lexical analyser in c language.. it urgent!!?
Someone left it too late to do their assignment....
Can we write coding for microcontroller(ATMEGA32) using both assembly and in C language simultaneously in AVR?
is there any other software which can have both coding in assembly and c within same program??
Can we write coding for microcontroller(ATMEGA32) using both assembly and in C language simultaneously in AVR?
Yeah, every compiler I've ever used for embedded development allowed you to inject assembly in the C code. I do believe there is usually a set of preprocessor commands you have to use to designate where you are using assembly.
Also, you must remember that when you compile a C/C++ program, it is effectively converting it to assembly/machine code, so it shouldn't be a surprise that being allowed to mix the two is a pretty common feature.
Reply:most c++ compilers can. you have to know how to write them together of course.
Can we write coding for microcontroller(ATMEGA32) using both assembly and in C language simultaneously in AVR?
Yeah, every compiler I've ever used for embedded development allowed you to inject assembly in the C code. I do believe there is usually a set of preprocessor commands you have to use to designate where you are using assembly.
Also, you must remember that when you compile a C/C++ program, it is effectively converting it to assembly/machine code, so it shouldn't be a surprise that being allowed to mix the two is a pretty common feature.
Reply:most c++ compilers can. you have to know how to write them together of course.
Hey!!!Are you a programmer ?? Can you help me to explain this Program in C-language? (below)? please !!?
Program in C using one-dimensional array that determines the lowest value among five input values from the keyboard and prints the difference of each value from the lowest.
INPUT: 28643
OUTPUT:
5
4
2
1
#include %26lt;stdio.h%26gt;
main()
{
int inp[5],i,min;
printf("Enter 5 values--%26gt;");
for (i=0; i%26lt;5;i++)
{
scanf("%d", %26amp;inp[i]);
}
min=inp[0];
for (i=1; i%26lt;5; i++)
{
if (inp[i] %26lt; min)
min=inp[i];
}
printf("Minimm=%d\n",min);
for(i=0; i%26lt;5;i++)
{
printf("%d\n", inp[i]-min);
}
}
Can you help me to explain this program in C (above) sentence-to-sentence. I need to explain this ASAP as part of my major requirement in my subject. pls.!!
Hey!!!Are you a programmer ?? Can you help me to explain this Program in C-language? (below)? please !!?
Here's the explanation:
-------------------------
#include %26lt;stdio.h%26gt;
-------------------------
This line tells us to INCLUDE a header file containing standard input output functions in our program, so that we can get input from user or output something to screen.
Then the main( ) function starts, where actual processing of the program is done.
---------------------
int inp[5],i,min;
---------------------
This line declares three integer type variables, the first one is an array (of 5 elements) for taking input numbers, the second variable is just used for loop iterations or as index value, and the third variable is used to store the minimum value.
--------------------------------------
printf("Enter 5 values--%26gt;");
--------------------------------------
This lines uses a function printf( ), which is used to print the argument, provided to this function, to screen. So this will print this text "Enter 5 values--%26gt;".
-----------------------------
for (i=0; i%26lt;5;i++)
{
scanf("%d", %26amp;inp[i]);
}
-----------------------------
This loop starts with the value of i=0 upto i=4, means it will repeat itself 5 times. In each run, it calls a function scanf( ), to scan or get the input of user.
First argument to this function, "%d", specifies that the input is going to be an integer, and the second argument is the address of the variable where this number should be stored. "%26amp;" operator is used to get the address. "inp[i]" indicates the ith element of the array inp. i.e. if i is 2, it means inp[2], which in turn means, the 3rd element of the array inp.
In this way, the loop gets all 5 numbers into the array inp.
---------------
min=inp[0];
--------------
This line assumes that inp[0], the first element of inp, is the smallest number. Note, this is just assumption. In actual, it may not be the smallest number.
------------------------
for (i=1; i%26lt;5; i++)
{
if (inp[i] %26lt; min)
min=inp[i];
}
------------------------
Again a loop that runs from 0 to 4, is used to get the actual minimum number. This is acheived by comparing the minimum number stored in "min" variable by each element in array "inp". If, in iteration, "min" is found to be less than the i-th element of inp array, it means that our previously stored minimum number is not the minimum, rather the current i-th element of inp array is minimum. So we assign that i-th element's value to the minimum number. Like if we had 22 in the "min" variable, and in the array, at i=2, the inp[2] had the value 16, then we should replace the value 22 in "min" by 16, so that now minimum number should reflect the correct value.
This process repeats in the loop until the loop ends.
-----------------------------------
printf("Minimm=%d\n",min);
-----------------------------------
Again, printf is used to output the text specified in arguments. %d means it should display a number inplace of %d. And this number comes from the "min" variable, the 2nd argument.
------------------------------
for(i=0; i%26lt;5;i++)
{
printf("%d\n", inp[i]-min);
}
------------------------------
In this loop, the difference of the each array element and the minimum number is printed. "\n" character is used to print a newline character, i.e. next line.
Reply:%26lt;stdio.h%26gt; is a header file,
main() is a function, a function returns a value.
int inp[5],i,min; is a declaration (all of the declaration is integer)
printf("Enter 5 values--%26gt;"); is the code for the "Enter 5 values--%26gt;" to appear in the execution.
for (i=0; i%26lt;5;i++) is a loop it has 3 parts, the intialization i=0; Comparison i%26lt;5; and increase i++. it is done when you need an iteration in ur program.
scanf("%d", %26amp;inp[i]); this is a code for the user to type a value during the execution.
if (inp[i] %26lt; min)
min=inp[i]; an if statement that input is less than the minimum and if the situation is true the value of min=inp[i];
I think that the rest are repition of the codes. I hope it helps you an some ways.
INPUT: 28643
OUTPUT:
5
4
2
1
#include %26lt;stdio.h%26gt;
main()
{
int inp[5],i,min;
printf("Enter 5 values--%26gt;");
for (i=0; i%26lt;5;i++)
{
scanf("%d", %26amp;inp[i]);
}
min=inp[0];
for (i=1; i%26lt;5; i++)
{
if (inp[i] %26lt; min)
min=inp[i];
}
printf("Minimm=%d\n",min);
for(i=0; i%26lt;5;i++)
{
printf("%d\n", inp[i]-min);
}
}
Can you help me to explain this program in C (above) sentence-to-sentence. I need to explain this ASAP as part of my major requirement in my subject. pls.!!
Hey!!!Are you a programmer ?? Can you help me to explain this Program in C-language? (below)? please !!?
Here's the explanation:
-------------------------
#include %26lt;stdio.h%26gt;
-------------------------
This line tells us to INCLUDE a header file containing standard input output functions in our program, so that we can get input from user or output something to screen.
Then the main( ) function starts, where actual processing of the program is done.
---------------------
int inp[5],i,min;
---------------------
This line declares three integer type variables, the first one is an array (of 5 elements) for taking input numbers, the second variable is just used for loop iterations or as index value, and the third variable is used to store the minimum value.
--------------------------------------
printf("Enter 5 values--%26gt;");
--------------------------------------
This lines uses a function printf( ), which is used to print the argument, provided to this function, to screen. So this will print this text "Enter 5 values--%26gt;".
-----------------------------
for (i=0; i%26lt;5;i++)
{
scanf("%d", %26amp;inp[i]);
}
-----------------------------
This loop starts with the value of i=0 upto i=4, means it will repeat itself 5 times. In each run, it calls a function scanf( ), to scan or get the input of user.
First argument to this function, "%d", specifies that the input is going to be an integer, and the second argument is the address of the variable where this number should be stored. "%26amp;" operator is used to get the address. "inp[i]" indicates the ith element of the array inp. i.e. if i is 2, it means inp[2], which in turn means, the 3rd element of the array inp.
In this way, the loop gets all 5 numbers into the array inp.
---------------
min=inp[0];
--------------
This line assumes that inp[0], the first element of inp, is the smallest number. Note, this is just assumption. In actual, it may not be the smallest number.
------------------------
for (i=1; i%26lt;5; i++)
{
if (inp[i] %26lt; min)
min=inp[i];
}
------------------------
Again a loop that runs from 0 to 4, is used to get the actual minimum number. This is acheived by comparing the minimum number stored in "min" variable by each element in array "inp". If, in iteration, "min" is found to be less than the i-th element of inp array, it means that our previously stored minimum number is not the minimum, rather the current i-th element of inp array is minimum. So we assign that i-th element's value to the minimum number. Like if we had 22 in the "min" variable, and in the array, at i=2, the inp[2] had the value 16, then we should replace the value 22 in "min" by 16, so that now minimum number should reflect the correct value.
This process repeats in the loop until the loop ends.
-----------------------------------
printf("Minimm=%d\n",min);
-----------------------------------
Again, printf is used to output the text specified in arguments. %d means it should display a number inplace of %d. And this number comes from the "min" variable, the 2nd argument.
------------------------------
for(i=0; i%26lt;5;i++)
{
printf("%d\n", inp[i]-min);
}
------------------------------
In this loop, the difference of the each array element and the minimum number is printed. "\n" character is used to print a newline character, i.e. next line.
Reply:%26lt;stdio.h%26gt; is a header file,
main() is a function, a function returns a value.
int inp[5],i,min; is a declaration (all of the declaration is integer)
printf("Enter 5 values--%26gt;"); is the code for the "Enter 5 values--%26gt;" to appear in the execution.
for (i=0; i%26lt;5;i++) is a loop it has 3 parts, the intialization i=0; Comparison i%26lt;5; and increase i++. it is done when you need an iteration in ur program.
scanf("%d", %26amp;inp[i]); this is a code for the user to type a value during the execution.
if (inp[i] %26lt; min)
min=inp[i]; an if statement that input is less than the minimum and if the situation is true the value of min=inp[i];
I think that the rest are repition of the codes. I hope it helps you an some ways.
How to get hard copy of output of the program created in "c" language in graphics?
i had used all coordinates of C window .
i had used the concept of print screen key of getting this problem 's solution....
How to get hard copy of output of the program created in "c" language in graphics?
your problem is some what serious. you have not mentioned the compiler. i have programming experience in Borland C. here, i used the combination of ALT + print screen. you said you used only print screen key. then use that combination. it works fine for text characters.
pokemon cards
i had used the concept of print screen key of getting this problem 's solution....
How to get hard copy of output of the program created in "c" language in graphics?
your problem is some what serious. you have not mentioned the compiler. i have programming experience in Borland C. here, i used the combination of ALT + print screen. you said you used only print screen key. then use that combination. it works fine for text characters.
pokemon cards
Can somebody please help me make a program for this problem in C language?
I am doing a program for this problem in C programming but I am having difficulty in doing it. The problem goes this way..
Write a program that will output the following number using a Do in a Do-while Loop.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Can somebody please help me make a program for this problem in C language?
#include %26lt;stdio.h%26gt;
int main ( void )
{
int number = 1, index = 1;
do
{
number=1;
do
{
printf ( "%d ", number );
number++;
}while (number %26lt;=index);
printf ( "\n" );
index++;
}while (index %26lt;= 5);
return 0;
}
Write a program that will output the following number using a Do in a Do-while Loop.
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Can somebody please help me make a program for this problem in C language?
#include %26lt;stdio.h%26gt;
int main ( void )
{
int number = 1, index = 1;
do
{
number=1;
do
{
printf ( "%d ", number );
number++;
}while (number %26lt;=index);
printf ( "\n" );
index++;
}while (index %26lt;= 5);
return 0;
}
Can i get exercises program of balaguru swami`s book of c language?
i want answers of the exerces program with complete coding of the balagruswami`s book it is a book of c programing and i also want other web site which help me in c program
Can i get exercises program of balaguru swami`s book of c language?
Not readily available at this time. You need to check with your local university computer lab to see what courses are available and what texts are being used in each. Furthermore, you should contact your local university bookstore for available manuals and books that can assist you in C Program. Many times the type book you are seeking is not available to students, but can be purchased by a member of the faculty.
Can i get exercises program of balaguru swami`s book of c language?
Not readily available at this time. You need to check with your local university computer lab to see what courses are available and what texts are being used in each. Furthermore, you should contact your local university bookstore for available manuals and books that can assist you in C Program. Many times the type book you are seeking is not available to students, but can be purchased by a member of the faculty.
What if i want to compare a lot of variables in c language? what function will i use?
i assigned a certain value in a certain variable, i have a lot of variables to compare with the user's input, what function will i use? (i'm making the mastermind program using c)
What if i want to compare a lot of variables in c language? what function will i use?
it depends.. what are you trying to achieve by your comparison? maybe you should compare what the memory that the variable points to contains if you are trying to find an exact match ... if you do do that remember to unallocate everything before assigning values in there also... but you can't do a broad sweep comparison, are you expecting string / char data or an integer or a float?? Need more detail for that one.
Reply:Erm.. in c language u can use an Array to compare the variables all... but u need to know how many space or bit u need for the array to loop for.. instead of this u can use Linked-List which no need to know how many space u need.. it only need u to assign new item if u need the space for the next variables... Hope it help up..
Reply:Instead use an array for those "a lot of variables to compare with "...meaning, store what is in those variables into a common array that way you can just use a for loop to compare them one at a time with your user input...in essense it could then be as small as 3 lines of code to compare them all and take an action.
What if i want to compare a lot of variables in c language? what function will i use?
it depends.. what are you trying to achieve by your comparison? maybe you should compare what the memory that the variable points to contains if you are trying to find an exact match ... if you do do that remember to unallocate everything before assigning values in there also... but you can't do a broad sweep comparison, are you expecting string / char data or an integer or a float?? Need more detail for that one.
Reply:Erm.. in c language u can use an Array to compare the variables all... but u need to know how many space or bit u need for the array to loop for.. instead of this u can use Linked-List which no need to know how many space u need.. it only need u to assign new item if u need the space for the next variables... Hope it help up..
Reply:Instead use an array for those "a lot of variables to compare with "...meaning, store what is in those variables into a common array that way you can just use a for loop to compare them one at a time with your user input...in essense it could then be as small as 3 lines of code to compare them all and take an action.
Please can anyone help me to write the following program in c language?
Write a C program using an if-else ladder that enables you to select one of 4 possible conversions by entering one of four possible integers as follows:
1. Octal to decimal
2. Hexadecimal to decimal
3. Decimal to octal
4. Decimal to hexadecimal
Include a menu in your program. Depending uopn your selection your program should propmt you to enter a suitable integer number, do the conversion and output the result.
Please can anyone help me to write the following program in c language?
Homework season has begun!
plum
1. Octal to decimal
2. Hexadecimal to decimal
3. Decimal to octal
4. Decimal to hexadecimal
Include a menu in your program. Depending uopn your selection your program should propmt you to enter a suitable integer number, do the conversion and output the result.
Please can anyone help me to write the following program in c language?
Homework season has begun!
plum
Can someone show me what this program would look like in C++ language?
1. Write a C++ program that reads two numbers,
a. Compares them and finds the greater number.
b. Checks if both of them are even numbers.
Sample Output 1
Enter the first number: 2
Enter the second number: 4
Number_2 is greater than Number_1
Number_1and Number_2 are both even numbers.
Can someone show me what this program would look like in C++ language?
#include %26lt;iostream%26gt;
using namespace std;
int main()
{
int a,b;
cout%26lt;%26lt;"Enter the first number: ";
cin%26gt;%26gt;a;
cout%26lt;%26lt;"Enter the second number: ";
cin%26gt;%26gt;b;
if (a%26gt;b)
cout%26lt;%26lt;"First Number is Greater\n";
else if(b%26gt;a)
cout%26lt;%26lt;"Second Number is Greater\n";
else
cout%26lt;%26lt;"Numbers are equal\n";
if((a%2==0)%26amp;%26amp;(b%2==0))
cout%26lt;%26lt;"Both Numbers are Even\n";
else
cout%26lt;%26lt;"One or More Numbers are Odd\n";
return 0;
}
Reply:void main
{
int first, second;
cout%26lt;%26lt;Enter first number;
cin%26gt;%26gt;first
cout%26lt;%26lt;Enter second number;
cin%26gt;%26gt;second;
if(first%26gt;second)
cout%26lt;%26lt; first
cout%26lt;%26lt; "is larger than"
cout%26lt;second
else if(second%26gt;first)
cout%26lt;%26lt; second
cout%26lt;%26lt; "is larger than"
cout%26lt;first
else
cout%26lt;%26lt;numbers are equal
if((first%2==0)%26amp;%26amp;(second%2==0))
cout%26lt;%26lt;both are even numbers
}
a. Compares them and finds the greater number.
b. Checks if both of them are even numbers.
Sample Output 1
Enter the first number: 2
Enter the second number: 4
Number_2 is greater than Number_1
Number_1and Number_2 are both even numbers.
Can someone show me what this program would look like in C++ language?
#include %26lt;iostream%26gt;
using namespace std;
int main()
{
int a,b;
cout%26lt;%26lt;"Enter the first number: ";
cin%26gt;%26gt;a;
cout%26lt;%26lt;"Enter the second number: ";
cin%26gt;%26gt;b;
if (a%26gt;b)
cout%26lt;%26lt;"First Number is Greater\n";
else if(b%26gt;a)
cout%26lt;%26lt;"Second Number is Greater\n";
else
cout%26lt;%26lt;"Numbers are equal\n";
if((a%2==0)%26amp;%26amp;(b%2==0))
cout%26lt;%26lt;"Both Numbers are Even\n";
else
cout%26lt;%26lt;"One or More Numbers are Odd\n";
return 0;
}
Reply:void main
{
int first, second;
cout%26lt;%26lt;Enter first number;
cin%26gt;%26gt;first
cout%26lt;%26lt;Enter second number;
cin%26gt;%26gt;second;
if(first%26gt;second)
cout%26lt;%26lt; first
cout%26lt;%26lt; "is larger than"
cout%26lt;second
else if(second%26gt;first)
cout%26lt;%26lt; second
cout%26lt;%26lt; "is larger than"
cout%26lt;first
else
cout%26lt;%26lt;numbers are equal
if((first%2==0)%26amp;%26amp;(second%2==0))
cout%26lt;%26lt;both are even numbers
}
Plzz give me a code to read the usb device in C++ language?
i.e to read from pen drive ,to take print out by printer that is attached to usb but all by using C++ coding
or u can also give me commands that will help me
Plzz give me a code to read the usb device in C++ language?
Well... that's a bit complicated. You could definitely read a file from a pen drive using a file stream, but you will need to interface with a printer driver in order to print it. You will need your OS's documentation to figure out how to do that.
or u can also give me commands that will help me
Plzz give me a code to read the usb device in C++ language?
Well... that's a bit complicated. You could definitely read a file from a pen drive using a file stream, but you will need to interface with a printer driver in order to print it. You will need your OS's documentation to figure out how to do that.
How can i find a "number to text" source code for C language?
I have some code in vb but i couldn't convert it to c
thanks
How can i find a "number to text" source code for C language?
check out http://www.pscode.com
Reply:This would be very easy if you know programming in C. You have a complete logic written in VB try to convert one by one statement to C.
Need help doing so, I can help you out!
Reply:walmart
thanks
How can i find a "number to text" source code for C language?
check out http://www.pscode.com
Reply:This would be very easy if you know programming in C. You have a complete logic written in VB try to convert one by one statement to C.
Need help doing so, I can help you out!
Reply:walmart
Where can I download a compiler and a debugger for free(c++ language)?
Want to learn c++!!!!
Help me..
Thanks
Where can I download a compiler and a debugger for free(c++ language)?
go to turbo c site %26amp; search for what you want.you will get only obsolete versions of c %26amp; c++,but those are sufficient for learners!(learned c on one of them).
if you want an advanced version, you woulkd have to go to an underground site or illegel download site
Reply:Browse this for list of downloads:
http://directory.fsf.org/devel/compilers...
Also check the head site, www.gnu.org. I guarantee you'll find anything you need.
parts of a flower
Help me..
Thanks
Where can I download a compiler and a debugger for free(c++ language)?
go to turbo c site %26amp; search for what you want.you will get only obsolete versions of c %26amp; c++,but those are sufficient for learners!(learned c on one of them).
if you want an advanced version, you woulkd have to go to an underground site or illegel download site
Reply:Browse this for list of downloads:
http://directory.fsf.org/devel/compilers...
Also check the head site, www.gnu.org. I guarantee you'll find anything you need.
parts of a flower
Can any one tell me about the importance and use of "C" language in programing??
I would like to know where and how do we use the "C" lang
and why is it important to learn this
would u help me by giving some books names and some web pages
Can any one tell me about the importance and use of "C" language in programing??
Hello
C language is one of the most important languages in the history of programming. The system you are using now is programed using it. Unix and all of its offsprings have been coded using it. it is an easy langugae if you understand what does langugae mean??
Langugae means a way of communication. So it has grammers and syntax. The most important point differs programming languages from human languages is that when a human makes a mistake when they talk to each other the pther part tries to guess and understand it. In the case of the computer it must be correct.
Using C you can create a complete Operating System. Many books and websites are available online.
Use yahoo to search.
Reply:the c has an importance that it can supports to implement any application.but without GUI inter face .ie we can use c as back end,and any Lang such as HTML using java as front end
Reply:C is probably the most important language for me. With C, we create applications and operating systems (Windows and UNIX/LINUX are created with C. Computer languages such as Visual Basic and JAVA are all created in C language. Computer viruses are mostly created in C, too.
C lacks in visual aspects, but it is very good in registry and memory management. It takes more time to build an application using C, compared to building apps in VB. But C provides us with sooo much control over everything the machine has to offer(machine resources). There are times when I have to return to C when my VB fail to help.
:-)
Reply:It is most important base for any type of programming. Basic steps are c -%26gt; c++ -%26gt; Java -%26gt; Adv.Java. I know because I'm in third year Engg. IT. I did it same way. Thats the only right path.
Reply:C came before C++. C isn't used anymore is it?
I think many computer games are done in C++
Reply:c is an basic to all structured languages.
Book-let us c-yeshwant kanetkar
and why is it important to learn this
would u help me by giving some books names and some web pages
Can any one tell me about the importance and use of "C" language in programing??
Hello
C language is one of the most important languages in the history of programming. The system you are using now is programed using it. Unix and all of its offsprings have been coded using it. it is an easy langugae if you understand what does langugae mean??
Langugae means a way of communication. So it has grammers and syntax. The most important point differs programming languages from human languages is that when a human makes a mistake when they talk to each other the pther part tries to guess and understand it. In the case of the computer it must be correct.
Using C you can create a complete Operating System. Many books and websites are available online.
Use yahoo to search.
Reply:the c has an importance that it can supports to implement any application.but without GUI inter face .ie we can use c as back end,and any Lang such as HTML using java as front end
Reply:C is probably the most important language for me. With C, we create applications and operating systems (Windows and UNIX/LINUX are created with C. Computer languages such as Visual Basic and JAVA are all created in C language. Computer viruses are mostly created in C, too.
C lacks in visual aspects, but it is very good in registry and memory management. It takes more time to build an application using C, compared to building apps in VB. But C provides us with sooo much control over everything the machine has to offer(machine resources). There are times when I have to return to C when my VB fail to help.
:-)
Reply:It is most important base for any type of programming. Basic steps are c -%26gt; c++ -%26gt; Java -%26gt; Adv.Java. I know because I'm in third year Engg. IT. I did it same way. Thats the only right path.
Reply:C came before C++. C isn't used anymore is it?
I think many computer games are done in C++
Reply:c is an basic to all structured languages.
Book-let us c-yeshwant kanetkar
Solve this problem with use of Ternary Operator in c language.?
write a c program which uses the ternary operator to print -1, 0 or 1 if the value input to it is negative, zero or positive.
ternary operator ----------------------------------------...
first_exp?second_exp : third_exp;
--------------------------------------...
if (first_exp)
x=second_exp;
else
x=third_exp;
--------------------------------------...
i think someone knowing this operator would solve it it seconds.
thanks in advance, i really need it.
Solve this problem with use of Ternary Operator in c language.?
Yes it can be solved using twoTernary operations in a row.
X%26gt;0? X=1:X
X%26lt;0? X=-1:X
If its not greater or less than zero it must be zero. No third test is needed for zero because you have eliminted all other possibilities which would change X if X is anything esle but zero
Reply:ternary operator is a substitute for if..else statement, meaning, there is only a TRUE part and a FALSE part...the problem cannot be solve by ternary alone..
Reply:(x%26lt;0)?(x= -1):((x%26gt;0)?(x=1:x=0)).This is the answer for your question. read it carefully u'll understand.
its simple its nested ternary operator.tat is if x%26lt;0 it sud b -Ve so x= -1 else it will execute the next expression which is another ternary operation tat is if x%26gt;0 it should be greater than 0 that is 1. else its 0. ok.so all 0,1,-1 will be printed accordingly..
ternary operator ----------------------------------------...
first_exp?second_exp : third_exp;
--------------------------------------...
if (first_exp)
x=second_exp;
else
x=third_exp;
--------------------------------------...
i think someone knowing this operator would solve it it seconds.
thanks in advance, i really need it.
Solve this problem with use of Ternary Operator in c language.?
Yes it can be solved using twoTernary operations in a row.
X%26gt;0? X=1:X
X%26lt;0? X=-1:X
If its not greater or less than zero it must be zero. No third test is needed for zero because you have eliminted all other possibilities which would change X if X is anything esle but zero
Reply:ternary operator is a substitute for if..else statement, meaning, there is only a TRUE part and a FALSE part...the problem cannot be solve by ternary alone..
Reply:(x%26lt;0)?(x= -1):((x%26gt;0)?(x=1:x=0)).This is the answer for your question. read it carefully u'll understand.
its simple its nested ternary operator.tat is if x%26lt;0 it sud b -Ve so x= -1 else it will execute the next expression which is another ternary operation tat is if x%26gt;0 it should be greater than 0 that is 1. else its 0. ok.so all 0,1,-1 will be printed accordingly..
I am in middle school but I am very much interested to learn C language. How can I install C language program?
I do not have problem even if I have to pay for the program to install on my computer. My school does not offer any programing right now. I can take some help from my father about installing and learning once C program is installed. Please help me.
I am in middle school but I am very much interested to learn C language. How can I install C language program?
Microsoft offers "Express" versions of their programming languages. That is for Visual C++ .NET.
http://msdn2.microsoft.com/en-us/express...
If you want to learn C, then I suggest getting a book. Look for the books that have a CD with them. They will have example programs and a lot of times have the free C compilers with them as well.
Probably the best book out there for beginners, but has no CD with it: http://www.amazon.com/C%2B%2B-Without-Fe...
SAMS, and QUE make good programming books in general. So check out ones by those two publishing companies. Also look for C programming book by Ivor Horton. His books are HUGE, but really easy to understand.
Whatever you do though, PLEASE stay away from Dummies books. They are known to be poorly written and often have mistakes in your code....You'll be sitting there for hours wondering why your simple "Hello World" program won't work.
Reply:go to www.bloodshed.net/devcpp.html
and then go to download page
use source forge click on download file-install on hard drive
when using program use source file
Reply:i dont know what it is or how to buy it
but im sure if you google it you can find something
and also learn it if you do get it cause its gonna make you money later even if its alittle bit
I am in middle school but I am very much interested to learn C language. How can I install C language program?
Microsoft offers "Express" versions of their programming languages. That is for Visual C++ .NET.
http://msdn2.microsoft.com/en-us/express...
If you want to learn C, then I suggest getting a book. Look for the books that have a CD with them. They will have example programs and a lot of times have the free C compilers with them as well.
Probably the best book out there for beginners, but has no CD with it: http://www.amazon.com/C%2B%2B-Without-Fe...
SAMS, and QUE make good programming books in general. So check out ones by those two publishing companies. Also look for C programming book by Ivor Horton. His books are HUGE, but really easy to understand.
Whatever you do though, PLEASE stay away from Dummies books. They are known to be poorly written and often have mistakes in your code....You'll be sitting there for hours wondering why your simple "Hello World" program won't work.
Reply:go to www.bloodshed.net/devcpp.html
and then go to download page
use source forge click on download file-install on hard drive
when using program use source file
Reply:i dont know what it is or how to buy it
but im sure if you google it you can find something
and also learn it if you do get it cause its gonna make you money later even if its alittle bit
Is there a commond for give a printout commond in DOS mode C language?
i make a project for printing the bill of medicins and i want to give a commond to this. what is the commond. please send with the syntax. the whole program in DOS mode C lanuage i.e; C using graphics.
Is there a commond for give a printout commond in DOS mode C language?
Research fprint()
Reply:i think freopen() can help u.
use it to print the file.
Reply:printf();
Use this command
mothers day flowers
Is there a commond for give a printout commond in DOS mode C language?
Research fprint()
Reply:i think freopen() can help u.
use it to print the file.
Reply:printf();
Use this command
mothers day flowers
How do I program 18 Futaba servo motors using ZEncore! C Language?
Please provide a copy of the C program. Thank you.
How do I program 18 Futaba servo motors using ZEncore! C Language?
I am not sure what you are asking because C is a language that can create software to run your servo motors, but there are many things to consider like the set up of the servo motors, what you intend to use them for. If you are using the software called ZEncore then it has it's own parameters, I am not familiar with it but I can tell you that it will be much simpler than programing it in C specially if you are asking how to........ Here is why? Using C you have to have a hardware card that will tell your servo motor what to do, In order for that card to work you need to know how to program it, execute it, and write the program code in C compile it and run it. You also need to know the type of chip on the card in order to see if you require external memory use such as that of the computer to make sure the program is followed and if there is any problems diagnose them as the program pauses. GOOD LUCK................
How do I program 18 Futaba servo motors using ZEncore! C Language?
I am not sure what you are asking because C is a language that can create software to run your servo motors, but there are many things to consider like the set up of the servo motors, what you intend to use them for. If you are using the software called ZEncore then it has it's own parameters, I am not familiar with it but I can tell you that it will be much simpler than programing it in C specially if you are asking how to........ Here is why? Using C you have to have a hardware card that will tell your servo motor what to do, In order for that card to work you need to know how to program it, execute it, and write the program code in C compile it and run it. You also need to know the type of chip on the card in order to see if you require external memory use such as that of the computer to make sure the program is followed and if there is any problems diagnose them as the program pauses. GOOD LUCK................
Need help with compound intertest program i am writing in C language?
this is a program i wrote to count the compound interest, but it's not working it's giving me following error message when i compile
"compound.c:(.text+0x69): undefined reference to `pow'
collect2: ld returned 1 exit status"
following the code
#include %26lt;stdio.h%26gt;
#include %26lt;math.h%26gt;
int main()
{
int rate;
int amount;
int p;
int n;
p=24;
printf("Rate\t\tAmount");
for(rate=5;rate%26lt;=10;rate++){
for(n=1; n%26lt;=381; n++){
amount=p*pow(1+(rate/100),n);
printf("%d\t\t%d", rate,amount);
}
}
return 0;
}
Need help with compound intertest program i am writing in C language?
You look like you are building with gcc and linux. Add '-lm' to link in the math library.
You will also want to chage 1+(rate/100) to 1.0+(rate/100.0) or something like that to make sure the math is done in floating point - as I don't think you want the integer truncation.
Good luck.
"compound.c:(.text+0x69): undefined reference to `pow'
collect2: ld returned 1 exit status"
following the code
#include %26lt;stdio.h%26gt;
#include %26lt;math.h%26gt;
int main()
{
int rate;
int amount;
int p;
int n;
p=24;
printf("Rate\t\tAmount");
for(rate=5;rate%26lt;=10;rate++){
for(n=1; n%26lt;=381; n++){
amount=p*pow(1+(rate/100),n);
printf("%d\t\t%d", rate,amount);
}
}
return 0;
}
Need help with compound intertest program i am writing in C language?
You look like you are building with gcc and linux. Add '-lm' to link in the math library.
You will also want to chage 1+(rate/100) to 1.0+(rate/100.0) or something like that to make sure the math is done in floating point - as I don't think you want the integer truncation.
Good luck.
How to write a state-driven realtime appilcation program in C language?? plzzz help its urgent!!!!?
i want to write a project on productionline control prg in C..........can u plz tell me which header files to be included and necessary requirements to proceeed with the program.........
How to write a state-driven realtime appilcation program in C language?? plzzz help its urgent!!!!?
well i have the c++ program file and the book, if u want it tell me in e-mail and i'll send it to you, don't worry no virus on my computer.
How to write a state-driven realtime appilcation program in C language?? plzzz help its urgent!!!!?
well i have the c++ program file and the book, if u want it tell me in e-mail and i'll send it to you, don't worry no virus on my computer.
Can I Eject/close the CD-ROM with "C++" language ??
I want to know if in the "C++" , there is a funtion enables you to open the CD-ROM and if there is please tell me how ..
Can I Eject/close the CD-ROM with "C++" language ??
Check this out:
http://www.codeproject.com/system/eject_...
song downloads
Can I Eject/close the CD-ROM with "C++" language ??
Check this out:
http://www.codeproject.com/system/eject_...
song downloads
Why would a Wall Street financial company use C++ language?
What does C++ do which is of benefit for a high finance company that was advertised in the Wall Street Journal?
Why would a Wall Street financial company use C++ language?
if they've been using it for a while, they probably have a library of custom objects and methods that make it easier to develop custom applications specific to their industry. It's similar to Java, but much faster.
Why would a Wall Street financial company use C++ language?
if they've been using it for a while, they probably have a library of custom objects and methods that make it easier to develop custom applications specific to their industry. It's similar to Java, but much faster.
What is the diffrence between public and protected keywords in C++ language?
The question belongs to Software programming language
What is the diffrence between public and protected keywords in C++ language?
Take a look here:
http://www.mcs.vuw.ac.nz/~phillip/www.cp...
http://www.mcs.vuw.ac.nz/~phillip/www.cp...
http://www.mcs.vuw.ac.nz/~phillip/www.cp...
What is the diffrence between public and protected keywords in C++ language?
Take a look here:
http://www.mcs.vuw.ac.nz/~phillip/www.cp...
http://www.mcs.vuw.ac.nz/~phillip/www.cp...
http://www.mcs.vuw.ac.nz/~phillip/www.cp...
I need a small project of any type in C language. It may be of any type.?
actually there is a technical fest in which we need to demonstrate any c project. so pls help me if any one has this. I already searched in google and sourceFordge.net etc
Pls help
I need a small project of any type in C language. It may be of any type.?
I'm a little confused here - don't you have your own imagination?
You claimed to have searched Google and SourceForge. If this is true then you didn't do a very thorough job of it...
Rawlyn.
p.s. LMAO! He doesn't just want an idea - he wants an idea and the finished product too!!! Do your own homework dammit!
Reply:you can perform a simple(application) project in c.
like
Compression and decompression
encryption and decryption
System side project
if you know electronics
you can combine it.
for example
when you click a button in your project then the fan will rotate.
Reply:You might be able to do a small project, and even get paid too!
Try going to getacoder.com.
That's an auction site for programmers. People who need programmers will explain what they want, and the amount they're willing to pay.
Read the information about the site first, then scan through the ads. Some people want a small program and would even pay $50 or more for something that may turn out to take only 20 minutes of programming work!
EDIT---
Oh, for crying out loud...
I can make you a project, but it will cost you $800.
Reply:I have to agree with my man Rawlyn on this one. Surely you should be able to use your imagination for this one!
anyway as you apparently don't have any imagination here are some simple projects you could do:
A Simple Game (always fun to make but don't get too over ambitious)
A Lighting Simulator (allow for 3d models to be placed in an environment and show how they are displayed using different lighting models phong, ray-tracing etc.)
A Visual Sound wave creator (allow the user to draw a sound wave on the screen then convert it to an audio signal and play it back to them looped)
Or best of all come up with something for yourself.
Pls help
I need a small project of any type in C language. It may be of any type.?
I'm a little confused here - don't you have your own imagination?
You claimed to have searched Google and SourceForge. If this is true then you didn't do a very thorough job of it...
Rawlyn.
p.s. LMAO! He doesn't just want an idea - he wants an idea and the finished product too!!! Do your own homework dammit!
Reply:you can perform a simple(application) project in c.
like
Compression and decompression
encryption and decryption
System side project
if you know electronics
you can combine it.
for example
when you click a button in your project then the fan will rotate.
Reply:You might be able to do a small project, and even get paid too!
Try going to getacoder.com.
That's an auction site for programmers. People who need programmers will explain what they want, and the amount they're willing to pay.
Read the information about the site first, then scan through the ads. Some people want a small program and would even pay $50 or more for something that may turn out to take only 20 minutes of programming work!
EDIT---
Oh, for crying out loud...
I can make you a project, but it will cost you $800.
Reply:I have to agree with my man Rawlyn on this one. Surely you should be able to use your imagination for this one!
anyway as you apparently don't have any imagination here are some simple projects you could do:
A Simple Game (always fun to make but don't get too over ambitious)
A Lighting Simulator (allow for 3d models to be placed in an environment and show how they are displayed using different lighting models phong, ray-tracing etc.)
A Visual Sound wave creator (allow the user to draw a sound wave on the screen then convert it to an audio signal and play it back to them looped)
Or best of all come up with something for yourself.
Any body give me output of the preprocessor for C language file.?
I want see exactly after proprocessor , what is going to happen to our .c file. It is going to convert some other extension file(hello.?).
Any body give me output of the preprocessor for C language file.?
Use -E option
example:-
gcc -E test.c %26gt; a
Reply:it is big issue dear... i am suggesting you that pls. dont think about it .. if you are thinks abt it so just contact to re putative companies those are developing these softwares ...
Reply:The # sign is called the preprocessor directive.
In C it is used to include the headers files in which the pre-defined function like #include%26lt;stdio.h%26gt; for printf() function.
actually when u save a file it is saved as e.g."hello.c", When u compile the program, a new file is genrated with extension "hello.obj"(if there is no syntactical error) and then linking is take place in which the pre defined function is linked with header files.
After that a new file with extension "hello.exe" is generate that will give the output after u run the program.
# is also used for "define"
e.g.-
#define size 10 //size can be a array length
Now u can use the size through out your program.
the main advantage of it is that if u have to change the length of array, then u r not going to modify the program everywhere u used 10 as size of array. u just to modify like
#define size 20
easter cards
Any body give me output of the preprocessor for C language file.?
Use -E option
example:-
gcc -E test.c %26gt; a
Reply:it is big issue dear... i am suggesting you that pls. dont think about it .. if you are thinks abt it so just contact to re putative companies those are developing these softwares ...
Reply:The # sign is called the preprocessor directive.
In C it is used to include the headers files in which the pre-defined function like #include%26lt;stdio.h%26gt; for printf() function.
actually when u save a file it is saved as e.g."hello.c", When u compile the program, a new file is genrated with extension "hello.obj"(if there is no syntactical error) and then linking is take place in which the pre defined function is linked with header files.
After that a new file with extension "hello.exe" is generate that will give the output after u run the program.
# is also used for "define"
e.g.-
#define size 10 //size can be a array length
Now u can use the size through out your program.
the main advantage of it is that if u have to change the length of array, then u r not going to modify the program everywhere u used 10 as size of array. u just to modify like
#define size 20
easter cards
Could any1 here help me with the C language?
Hello every1, I am an IT student n wanna know abt sm links/books 2 ensure I hv good C skills. If any1 cud help me, I wud b obliged.
Could any1 here help me with the C language?
well,when it comes 2 testing your skills,there is lot u can do...but i'll advice u 2 go for "exploring C" by yashavanth kanetkar!!!it is a brilliant book n am sure that this book will help you enormously!! then u can also try books like - let us C,C pearls,test your skills in C programming n when it comes 2 websites,there r plenty...its better you take 2 the search engines...you will get loads of info frm them...sites like about.com, www.cprogramming.com. could help 22!!all the best!!!
Reply:i think we ask questions here for which there are no text book answers or people generally may not know the answers. such questions are aired here so that some good soul may clarify our doubts. but your question pertains to a particular computer skill which is taught at institutions and text books. pls refer them.
Reply:Sure anytime when it comes to C/C++ you can mail me at joydeep1982@gmail.com and here is something for you to help you temporarily
http://analysingc.50webs.com
this is my website ..... check out n reply i will be waiting
Reply:See this lkink it will help u http://www.parashift.com/c++-faq-lite/in... it contains a lot of very good questions and answers
Could any1 here help me with the C language?
well,when it comes 2 testing your skills,there is lot u can do...but i'll advice u 2 go for "exploring C" by yashavanth kanetkar!!!it is a brilliant book n am sure that this book will help you enormously!! then u can also try books like - let us C,C pearls,test your skills in C programming n when it comes 2 websites,there r plenty...its better you take 2 the search engines...you will get loads of info frm them...sites like about.com, www.cprogramming.com. could help 22!!all the best!!!
Reply:i think we ask questions here for which there are no text book answers or people generally may not know the answers. such questions are aired here so that some good soul may clarify our doubts. but your question pertains to a particular computer skill which is taught at institutions and text books. pls refer them.
Reply:Sure anytime when it comes to C/C++ you can mail me at joydeep1982@gmail.com and here is something for you to help you temporarily
http://analysingc.50webs.com
this is my website ..... check out n reply i will be waiting
Reply:See this lkink it will help u http://www.parashift.com/c++-faq-lite/in... it contains a lot of very good questions and answers
What does the phrase "int" mean in the C++ language?
I'm learning C++ with a how-to book and am very new, so please bear with me. What does the term "int" mean? How/why is it used? Is there a specific reason why it's in lowercase?
What does the phrase "int" mean in the C++ language?
and int is as he said. it can only stor real number(not decimal point) and the reason its like int adn blue is because c++ is object orientated adn the 'int' is a keyword. meaning it cant be used a a name for a variable. here is a site that will realy help you with your c++, jsut dont give up....
http://www.fredosaurus.com/notes-cpp/ind...
Reply:int is short form of Integer. int means the type of variable that stores the integer value. eg. int i. so i is a variable that can store only integer value like 1,2,3,etc but not something like 1.2 or 1.5. int variables have 2 bits. this is just introductory. u can google for more information.
Reply:As many have said, int is short for integer. It is usually used as a variable declaration:
int x = 5;
Declares a variable x of type integer, and assigns it a default value of 5. It can also be used as a casting variable:
long bigNumber = 3845757839238477;
int v = (int)bigNumber;
Here, an integer named v is declared and is assigned the value of the long v. A long is just like an integer, except it can have a wider range of values, hence the name long! (it's longer than int). Here I used the 'int' statement to cast bigNumber to an integer and assign it to v.
Reply:int is integer number; no reason for being lowercase but just convenient to do so.
Integer numbers are whole numbers, this kind of number in computers are more efficient and stocastic to use than float. If you want an elaboration on fractional numbers within computers wiki the terms "floating point" and "fixed point".
Reply:"int" is shorthand for Integer, meaning a Number!
Happy Coding! And please rate me as best Answer! ;)
What does the phrase "int" mean in the C++ language?
and int is as he said. it can only stor real number(not decimal point) and the reason its like int adn blue is because c++ is object orientated adn the 'int' is a keyword. meaning it cant be used a a name for a variable. here is a site that will realy help you with your c++, jsut dont give up....
http://www.fredosaurus.com/notes-cpp/ind...
Reply:int is short form of Integer. int means the type of variable that stores the integer value. eg. int i. so i is a variable that can store only integer value like 1,2,3,etc but not something like 1.2 or 1.5. int variables have 2 bits. this is just introductory. u can google for more information.
Reply:As many have said, int is short for integer. It is usually used as a variable declaration:
int x = 5;
Declares a variable x of type integer, and assigns it a default value of 5. It can also be used as a casting variable:
long bigNumber = 3845757839238477;
int v = (int)bigNumber;
Here, an integer named v is declared and is assigned the value of the long v. A long is just like an integer, except it can have a wider range of values, hence the name long! (it's longer than int). Here I used the 'int' statement to cast bigNumber to an integer and assign it to v.
Reply:int is integer number; no reason for being lowercase but just convenient to do so.
Integer numbers are whole numbers, this kind of number in computers are more efficient and stocastic to use than float. If you want an elaboration on fractional numbers within computers wiki the terms "floating point" and "fixed point".
Reply:"int" is shorthand for Integer, meaning a Number!
Happy Coding! And please rate me as best Answer! ;)
What is the code for leaving space in C language?
I want to leave a blank space in C code.
EX. "\n" for new line.
what is for single space.
What is the code for leaving space in C language?
The space bar works pretty well.
Reply:There is no code for space similar to '\n'. It is just the space bar just like you used to enter your question.
Reply:I'm not sure there is one - assuming this is for formatted output, I'd expect just leaving a space to work.
If you just need "some" whitespace, try "\t" for a tab character.
EX. "\n" for new line.
what is for single space.
What is the code for leaving space in C language?
The space bar works pretty well.
Reply:There is no code for space similar to '\n'. It is just the space bar just like you used to enter your question.
Reply:I'm not sure there is one - assuming this is for formatted output, I'd expect just leaving a space to work.
If you just need "some" whitespace, try "\t" for a tab character.
Bitmap header file loading error using C language?
I'm working with bitmap image using c programming. This my header file structure shown below:
word bmpType;
dword bmpSize;
word bmpReserved1;
word bmpReserved2;
dword bOffBits;
The header file should be 14 byte as shown above, but when i use sizeof() for the structure above, it returned 16. This problem causes the data loaded inside the member of the structure to be mistake since everythings are shifted with two bytes. I've looked through my code, and it seems no problem for the code. Please let me know what is the cause of this problem and how to solve it.
Bitmap header file loading error using C language?
Your problem has to do with the structure member alignment when the compiler generates the code. In MS VS the default is on a 4 byte boundary e.g. 4, 8 12, 16, 20, etc.
You can change this by going into the property page for the project (project|property) and selecting c/c++/Code Generation option, and change Struct Member Alignment to 1 byte.
This info is for MS VS 2005.
if you are using some other dev environment, there should be something similar.
brenda song
word bmpType;
dword bmpSize;
word bmpReserved1;
word bmpReserved2;
dword bOffBits;
The header file should be 14 byte as shown above, but when i use sizeof() for the structure above, it returned 16. This problem causes the data loaded inside the member of the structure to be mistake since everythings are shifted with two bytes. I've looked through my code, and it seems no problem for the code. Please let me know what is the cause of this problem and how to solve it.
Bitmap header file loading error using C language?
Your problem has to do with the structure member alignment when the compiler generates the code. In MS VS the default is on a 4 byte boundary e.g. 4, 8 12, 16, 20, etc.
You can change this by going into the property page for the project (project|property) and selecting c/c++/Code Generation option, and change Struct Member Alignment to 1 byte.
This info is for MS VS 2005.
if you are using some other dev environment, there should be something similar.
brenda song
Function for copying a file in c language?
for writing nc i should copy file from a drive and paste it in other
drive or location .what function i should use for copying a file.
and also for cuting a file.
notice:i am programing in c.
Function for copying a file in c language?
On UNIX style systems you can execute commands with the system call, for example
system("cp pathname1 pathname2")
Likewise on Windows but with copy instead of cp.
http://www.die.net/doc/linux/man/man3/sy...
Windows has a CopyFile function which can be called from C.
http://msdn.microsoft.com/library/defaul...
Reply:This is not tested and has no real error checking but should get you started.
int copy (char * src, char * dest)
{
char buf[1024];
FILE * in, *out;
in = fopen(src, "r");
if(in == NULL)
{
return(-1);
}
out = fopen(dest,"w");
if(out == NULL)
{
return(-1);
}
while(fread( buf,
sizeof(buf),
1,
in))
{
fwrite(buf,
sizeof(buf),
1,
out);
}
fclose(in);
fclose(out);
return(0);
}
Reply:Or you can have the program do it with the appropriate calls. Use C file I/O to open the file, write it to another file at the new location, close both. Then make calls to appropriate functions to delete the old files if needed. I beleive that unlink works in *nix and kill works under DOS or DOS box. You'll have to look up the Windows functions if you need it in the Win32 or Win32s APIs. I hope this helps.
Reply:DanD is quite rignt. One additional detail: you can use function "system" in DOS and Windows also.
system( "copy pathname_1 pathname_2" );
If you want to "cut" the file call then
system( "del pathname_1" ) for Windows
of
system( "rm pathname_1" ) for *NIX
drive or location .what function i should use for copying a file.
and also for cuting a file.
notice:i am programing in c.
Function for copying a file in c language?
On UNIX style systems you can execute commands with the system call, for example
system("cp pathname1 pathname2")
Likewise on Windows but with copy instead of cp.
http://www.die.net/doc/linux/man/man3/sy...
Windows has a CopyFile function which can be called from C.
http://msdn.microsoft.com/library/defaul...
Reply:This is not tested and has no real error checking but should get you started.
int copy (char * src, char * dest)
{
char buf[1024];
FILE * in, *out;
in = fopen(src, "r");
if(in == NULL)
{
return(-1);
}
out = fopen(dest,"w");
if(out == NULL)
{
return(-1);
}
while(fread( buf,
sizeof(buf),
1,
in))
{
fwrite(buf,
sizeof(buf),
1,
out);
}
fclose(in);
fclose(out);
return(0);
}
Reply:Or you can have the program do it with the appropriate calls. Use C file I/O to open the file, write it to another file at the new location, close both. Then make calls to appropriate functions to delete the old files if needed. I beleive that unlink works in *nix and kill works under DOS or DOS box. You'll have to look up the Windows functions if you need it in the Win32 or Win32s APIs. I hope this helps.
Reply:DanD is quite rignt. One additional detail: you can use function "system" in DOS and Windows also.
system( "copy pathname_1 pathname_2" );
If you want to "cut" the file call then
system( "del pathname_1" ) for Windows
of
system( "rm pathname_1" ) for *NIX
Whay can be done after learning c++ language?
CAN I CREATE SOFTWARES OF MINE OR WHT CAN I CREATE AFTER LEARNING C++ LNAGUAGE PLZ ADVICE SOME GENUINE SUGGESTIONS!
Whay can be done after learning c++ language?
Well can you ever really say you have fully learned a programming langauge? I mean they are always changing always advancing. Now if you are asking what can or should you do after learning the "basics" of the C++ language? Well uhm, then yes you can very well create software of your own, it will not be anything to advanced though... I mean typically when you start out learning C++ you only really focus on "Console" based programs. They are not the most interesting programs but are great for testing out what you have learned and can be made into very creative, but still simple applications.
Now if you feel you have learned all you can learn when it comes to building a console type of application in C++ then well maybe its time to dive into "windows" programming, you know the whole creating a GUI and what not. It is very complex work but the final result is very much worth the time.
Suggestions after learning the basics of C++
1. Apply your knowledge of C++ and journey into other Object oriented langauges, like java.
2. Keep going with C++, keep creating simple applications and sharpening your skills
3. Journey into the glories world of GUI programming, a rocky road it is but extremely worth the effort and time
5. Find a area programming you prefer (video game programming, gui programming, network programming, database programming, etc) and focus on it
6. Do all of the above, expand your horzion :)
Its really all up to you, personally id say to apply what you learn to other programming languages and learn them, it is fun and makes it easier to learn new programming languages. Either way have fun with it, the world of programming is a glories thing for you can do so much with it, have fun and good luck :)
Reply:Depends on what you are trying to create. If its a simple app sure. Also if your interested in the programming field go for it. if your in it just because someone said you can make moolah your in for a long ride. System programming takes passion believe me I've looked at enough peoples code to know how passionate they were about their work.
Reply:Sure you can, but start out with easy stuff first. I guarantee the first you will learn is that there is still more to learn, and it never ends.
Reply:simple ones yes, advanced ones nah not yet but don't bother with it anyways cz u'll find everything u need around and it is a very boring field
Whay can be done after learning c++ language?
Well can you ever really say you have fully learned a programming langauge? I mean they are always changing always advancing. Now if you are asking what can or should you do after learning the "basics" of the C++ language? Well uhm, then yes you can very well create software of your own, it will not be anything to advanced though... I mean typically when you start out learning C++ you only really focus on "Console" based programs. They are not the most interesting programs but are great for testing out what you have learned and can be made into very creative, but still simple applications.
Now if you feel you have learned all you can learn when it comes to building a console type of application in C++ then well maybe its time to dive into "windows" programming, you know the whole creating a GUI and what not. It is very complex work but the final result is very much worth the time.
Suggestions after learning the basics of C++
1. Apply your knowledge of C++ and journey into other Object oriented langauges, like java.
2. Keep going with C++, keep creating simple applications and sharpening your skills
3. Journey into the glories world of GUI programming, a rocky road it is but extremely worth the effort and time
5. Find a area programming you prefer (video game programming, gui programming, network programming, database programming, etc) and focus on it
6. Do all of the above, expand your horzion :)
Its really all up to you, personally id say to apply what you learn to other programming languages and learn them, it is fun and makes it easier to learn new programming languages. Either way have fun with it, the world of programming is a glories thing for you can do so much with it, have fun and good luck :)
Reply:Depends on what you are trying to create. If its a simple app sure. Also if your interested in the programming field go for it. if your in it just because someone said you can make moolah your in for a long ride. System programming takes passion believe me I've looked at enough peoples code to know how passionate they were about their work.
Reply:Sure you can, but start out with easy stuff first. I guarantee the first you will learn is that there is still more to learn, and it never ends.
Reply:simple ones yes, advanced ones nah not yet but don't bother with it anyways cz u'll find everything u need around and it is a very boring field
How do you make an asterisks pattern in the C (not C++) language?
Here is what I need to know. I want to generate the following pattern in a C (not C++) console app that prints out EXACTLY as shown.
*
**
***
****
*****
******
*******
********
*********
**********
......
Well... you get the idea. Thanks!
How do you make an asterisks pattern in the C (not C++) language?
Are you in your first c class? Use a nested for loop. The first one should be for the row and the second one for the column.
Reply:i dont know, nor do i care!
Reply:This should do it:
int _tmain(int argc, _TCHAR* argv[])
{
for ( int count = 1; count %26lt; 11; count++)
{
fprintf( stdout, "%-10.*s\n", count, "**********" );
}
return 0;
}
Reply:suppose the number of lines to print is N the code is
for (i=1;i%26lt;=N;i++){
for(j=1;j%26lt;=i;j++){
printf("*");
}
printf("\n");
}
*
**
***
****
*****
******
*******
********
*********
**********
......
Well... you get the idea. Thanks!
How do you make an asterisks pattern in the C (not C++) language?
Are you in your first c class? Use a nested for loop. The first one should be for the row and the second one for the column.
Reply:i dont know, nor do i care!
Reply:This should do it:
int _tmain(int argc, _TCHAR* argv[])
{
for ( int count = 1; count %26lt; 11; count++)
{
fprintf( stdout, "%-10.*s\n", count, "**********" );
}
return 0;
}
Reply:suppose the number of lines to print is N the code is
for (i=1;i%26lt;=N;i++){
for(j=1;j%26lt;=i;j++){
printf("*");
}
printf("\n");
}
How to solve sudoku using "C" language?
hi
any idea?
would it be simple program ( 10 - 15 ) pages
is it easy to write a program in c that solves sudoku boards...
thanks
How to solve sudoku using "C" language?
I think it could range from pretty easy to somewhat difficult depending on how you implement the algorithm.
A simple recursive algorithm could be written to solve it just by trying every different possible combination until it came up with the right answer. This would probably take maybe a page or two of code and very little brain power.
But if you don't like the brute force method, you could implement the algorithm with a little more 'intelligence' to try only the more viable combinations. This probably won't be much longer of a program, but it will be more complex and take more analytical thinking on your behalf.
****Edit****
Well I got a little side tracked from other things and decided to implement a program to solve this problem. I admit its something I've thought about doing for a while, so I figured why not.
Anyway , it was pretty easy; took me about an hour and about 130 lines of code, and works great. It reads the Sudoku board in from a text file, solves it, and then outputs the result to another text file. It uses a recursive algorithm that finds the first empty box on the board, fills it with a valid value, and recursively calls itself to do the same on the next empty box. It will keep going this way until there are no valid values to put in the box, in which case it returns false; or if there are no more empty boxes, in which case it returns true. If false is returned, it will keep trying the next valid value until true is returned or there are no more valid values.
I hope my explanation makes sense; if you sit down and think about it, it's really not that complicated. If you want to see my source code, feel free to email me.
Reply:Like most other problems, a SUDOKU solver can use multiple approaches.
The one which may be appropriate will be Backtracking. You read some notes on how backtracking is done.
The basic concept behind this is,
based on available parameters, you presume some values and when it is found that the values assumed go wrong during the course of solving the problem, you go back one step and try again. In this way, you can bring the solution.
Thank You!!
Reply:I am thinking this would not be a very easy program to write, but that all depends on your level of experience, and your definition of 'easy'. If you think 15 pages of code qualifies as easy, then it may be easy for you. I think it would require very complex logic, similar to that necessary for a chess or checkers game.
bouquet
any idea?
would it be simple program ( 10 - 15 ) pages
is it easy to write a program in c that solves sudoku boards...
thanks
How to solve sudoku using "C" language?
I think it could range from pretty easy to somewhat difficult depending on how you implement the algorithm.
A simple recursive algorithm could be written to solve it just by trying every different possible combination until it came up with the right answer. This would probably take maybe a page or two of code and very little brain power.
But if you don't like the brute force method, you could implement the algorithm with a little more 'intelligence' to try only the more viable combinations. This probably won't be much longer of a program, but it will be more complex and take more analytical thinking on your behalf.
****Edit****
Well I got a little side tracked from other things and decided to implement a program to solve this problem. I admit its something I've thought about doing for a while, so I figured why not.
Anyway , it was pretty easy; took me about an hour and about 130 lines of code, and works great. It reads the Sudoku board in from a text file, solves it, and then outputs the result to another text file. It uses a recursive algorithm that finds the first empty box on the board, fills it with a valid value, and recursively calls itself to do the same on the next empty box. It will keep going this way until there are no valid values to put in the box, in which case it returns false; or if there are no more empty boxes, in which case it returns true. If false is returned, it will keep trying the next valid value until true is returned or there are no more valid values.
I hope my explanation makes sense; if you sit down and think about it, it's really not that complicated. If you want to see my source code, feel free to email me.
Reply:Like most other problems, a SUDOKU solver can use multiple approaches.
The one which may be appropriate will be Backtracking. You read some notes on how backtracking is done.
The basic concept behind this is,
based on available parameters, you presume some values and when it is found that the values assumed go wrong during the course of solving the problem, you go back one step and try again. In this way, you can bring the solution.
Thank You!!
Reply:I am thinking this would not be a very easy program to write, but that all depends on your level of experience, and your definition of 'easy'. If you think 15 pages of code qualifies as easy, then it may be easy for you. I think it would require very complex logic, similar to that necessary for a chess or checkers game.
bouquet
How do I create a crossword in 'C' language?
Hi,
As part of a project, I have to create a basic crossword in Microsoft Visual C++ but I cannot find any links to help me out! I would be really greatful if you could point me in the right direction...
Thanks!
How do I create a crossword in 'C' language?
may be this site help u...
http://www.codeproject.com/info/search.a...
As part of a project, I have to create a basic crossword in Microsoft Visual C++ but I cannot find any links to help me out! I would be really greatful if you could point me in the right direction...
Thanks!
How do I create a crossword in 'C' language?
may be this site help u...
http://www.codeproject.com/info/search.a...
Please help me with this program using c++ language.?
write a c++ program that would print a calendar. input month number from 1 to 12 only, number of the days in a month and the first day of the month from 1 to 7.
sample output
screen 1
input month number: 12
enter year: 2005
first day of the month: 4
2nd screen
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
(the 2nd screen should look like a CALENDAR but due to typing error th number are not align into the month)
Please help me with this program using c++ language.?
Make a 5 x 7 array to hold the dates,
a[0][0] would correspond to the first possible sunday
Then based on the starting day have it put one in that spot, so if the first day of the month i.e.
a[startdate][0] would put a number in there
then write a loop to fill the remaining days up to the max day
then a loop to print the results to the screen
Reply:I could write this for you. In fact, I was helping another programming student with this exact problem and wrote it for myself to make sure I was giving the proper help. But you can't learn programming this way. You have to write the program yourself. If I send you my code, then you will get a good score on this assignment, but when it comes exam time you are going to fail miserably. Your instructor will put 2 and 2 together and quite possibly fail you for the entire class for not doing your own work
If you want help, email me at dogsafire@yahoo.com. I will help, but I will NOT do your work for you. That would not be helping.
By the way, the main issue in this program is keeping track of what day to start each month on.
sample output
screen 1
input month number: 12
enter year: 2005
first day of the month: 4
2nd screen
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
(the 2nd screen should look like a CALENDAR but due to typing error th number are not align into the month)
Please help me with this program using c++ language.?
Make a 5 x 7 array to hold the dates,
a[0][0] would correspond to the first possible sunday
Then based on the starting day have it put one in that spot, so if the first day of the month i.e.
a[startdate][0] would put a number in there
then write a loop to fill the remaining days up to the max day
then a loop to print the results to the screen
Reply:I could write this for you. In fact, I was helping another programming student with this exact problem and wrote it for myself to make sure I was giving the proper help. But you can't learn programming this way. You have to write the program yourself. If I send you my code, then you will get a good score on this assignment, but when it comes exam time you are going to fail miserably. Your instructor will put 2 and 2 together and quite possibly fail you for the entire class for not doing your own work
If you want help, email me at dogsafire@yahoo.com. I will help, but I will NOT do your work for you. That would not be helping.
By the way, the main issue in this program is keeping track of what day to start each month on.
Friday, July 31, 2009
Explain data type range for integers in C language?
Why am i getting this output for the following C program?
#include %26lt;stdio.h%26gt;
#include %26lt;conio.h%26gt;
int input=-2147483649;
main()
{
printf("%d",input);
getch();
}
Output:
2147,483,647
Explain data type range for integers in C language?
Dude you need to go out more .
Reply:Hi
As a previous answerer has intimated int (or long int) overflows outside of the range -2147483647 to +2147483647
Suggest you use:
double inpt = -2147483649.0;
main()
{
printf("%10.0lf\n",inpt);
}
This will give you what you want.
Regards
G
Reply:Range = -pow(2, 31) to pow(2, 31) - 1
-2147483649 is less than -pow(2, 31)
(by one actually)
Reply:because that is max limit
it is converting it to +ve number because 1 bit is used for sign (lsb or msb ? )
#include %26lt;stdio.h%26gt;
#include %26lt;conio.h%26gt;
int input=-2147483649;
main()
{
printf("%d",input);
getch();
}
Output:
2147,483,647
Explain data type range for integers in C language?
Dude you need to go out more .
Reply:Hi
As a previous answerer has intimated int (or long int) overflows outside of the range -2147483647 to +2147483647
Suggest you use:
double inpt = -2147483649.0;
main()
{
printf("%10.0lf\n",inpt);
}
This will give you what you want.
Regards
G
Reply:Range = -pow(2, 31) to pow(2, 31) - 1
-2147483649 is less than -pow(2, 31)
(by one actually)
Reply:because that is max limit
it is converting it to +ve number because 1 bit is used for sign (lsb or msb ? )
I/O header file error in c language?
Whenever I tri to compile the c program it give me error that i/o header file is not included.i have set the right path in directory still It is giving me error .How can I remove it. Hel p me plz .
I/O header file error in c language?
You mean stdio.h? You should include it like this:
#include %26lt;stdio.h%26gt;
A common mistake is to use quotes instead of angle brackets, but all system header files require the brackets.
Reply:YOU FIRST CHECK OUT WHETHER THE IO HEADER FILE IS IN INCLUDE DIRECTORY .IF IT IS NOT THERE PLEASE COPY FROM ANY WHERE AND PUT IT IN THAT INCLUDE DIRECTORY.IF U ARE USING C EDITOR FROM UR C:WINDOWS U HAVE TO COPY THE ENTIRE 'C' PROGRAMFILES IN THAT(C:\).IF NOT U CAN USE OTHER DRIVES BY SETTING PATHS AS FOLLOWS:
1.GO FOR OPTIONS INTHAT GO FOR DIRECTORIES :
2.HERE YOU HAVE FIEDS TO ENTER
a.INCLUDE\
b.LIBRARIES\
c.OUTPUT\
PLEASE FULFILL THE FIEDS AS FOR UR 'C' SETTINGS.
AND ENJOY THE 'C' PROGRAMING.
yu gi oh cards
I/O header file error in c language?
You mean stdio.h? You should include it like this:
#include %26lt;stdio.h%26gt;
A common mistake is to use quotes instead of angle brackets, but all system header files require the brackets.
Reply:YOU FIRST CHECK OUT WHETHER THE IO HEADER FILE IS IN INCLUDE DIRECTORY .IF IT IS NOT THERE PLEASE COPY FROM ANY WHERE AND PUT IT IN THAT INCLUDE DIRECTORY.IF U ARE USING C EDITOR FROM UR C:WINDOWS U HAVE TO COPY THE ENTIRE 'C' PROGRAMFILES IN THAT(C:\).IF NOT U CAN USE OTHER DRIVES BY SETTING PATHS AS FOLLOWS:
1.GO FOR OPTIONS INTHAT GO FOR DIRECTORIES :
2.HERE YOU HAVE FIEDS TO ENTER
a.INCLUDE\
b.LIBRARIES\
c.OUTPUT\
PLEASE FULFILL THE FIEDS AS FOR UR 'C' SETTINGS.
AND ENJOY THE 'C' PROGRAMING.
yu gi oh cards
How to use random functions in 'c' language?
how do u use the random function in c........?
i want the function to generate values between a specific range of values........
How to use random functions in 'c' language?
The rand() function will always return a value between 0 and an implementation-defined quantity, RAND_MAX. To use rand() to produce integers in the range from x
to y, inclusive, you should use something like:
/* initialize random generator */
srand ( time(NULL) );
int result = x+(int) ((y -x +1) * (double)rand()/(RAND_MAX + 1.0));
____________________
/*Alternative: Use the modulus operator (%) to bring the number in range.*/
printf ("A number between 0 and RAND_MAX : %d\n", rand());
printf ("A number between 0 and 99: %d\n", rand() % 100);
printf ("A number between 0 and 9: %d\n", rand() % 10);
Reply:#include %26lt;time.h%26gt;
#include %26lt;stdlib.h%26gt;
main()
{
srand(time(0));
int random=rand()%255+1; //from 1 to 255
}
Reply:#include %26lt;time.h%26gt;
#include %26lt;stdlib.h%26gt;
int main()
{
srand((unsigned)time(0));
int random=rand()%10+1; //from 1 to 10
}
i want the function to generate values between a specific range of values........
How to use random functions in 'c' language?
The rand() function will always return a value between 0 and an implementation-defined quantity, RAND_MAX. To use rand() to produce integers in the range from x
to y, inclusive, you should use something like:
/* initialize random generator */
srand ( time(NULL) );
int result = x+(int) ((y -x +1) * (double)rand()/(RAND_MAX + 1.0));
____________________
/*Alternative: Use the modulus operator (%) to bring the number in range.*/
printf ("A number between 0 and RAND_MAX : %d\n", rand());
printf ("A number between 0 and 99: %d\n", rand() % 100);
printf ("A number between 0 and 9: %d\n", rand() % 10);
Reply:#include %26lt;time.h%26gt;
#include %26lt;stdlib.h%26gt;
main()
{
srand(time(0));
int random=rand()%255+1; //from 1 to 255
}
Reply:#include %26lt;time.h%26gt;
#include %26lt;stdlib.h%26gt;
int main()
{
srand((unsigned)time(0));
int random=rand()%10+1; //from 1 to 10
}
How to make chatt room using C# language?
i want to make my final project on chatroom so i want to write the code in c# what are the core thing that i have to know
How to make chatt room using C# language?
hi dear ,first you have to have a good knowledge on staff like html,C# and .... but, it is possible to desigen chat room simply by using frames to desigen
How to make chatt room using C# language?
hi dear ,first you have to have a good knowledge on staff like html,C# and .... but, it is possible to desigen chat room simply by using frames to desigen
How can i save graphics in c language?
I have a program in c that generates a graphics output using graphics.h. But i cant seem to save the graphic as a file. How do i do this?
How can i save graphics in c language?
you save the program in a folder named c:\cprog (say)
Then you compile and run the program...
After that come out and go to cprog folder you will find two file in that one exe file will be there...
You can double click that.. you can see your graphics..
You can change the icon for that file that suits the graphics...
Okay...
How can i save graphics in c language?
you save the program in a folder named c:\cprog (say)
Then you compile and run the program...
After that come out and go to cprog folder you will find two file in that one exe file will be there...
You can double click that.. you can see your graphics..
You can change the icon for that file that suits the graphics...
Okay...
I want to do projects on c language?pls tell me d related websites?
i want to do projects on c,to earn money
I want to do projects on c language?pls tell me d related websites?
Take a look here so you can have a base
http://en.wikipedia.org/wiki/C_programmi...
Then you should try to look for a job with this language. So you can learn more.
thank you cards
I want to do projects on c language?pls tell me d related websites?
Take a look here so you can have a base
http://en.wikipedia.org/wiki/C_programmi...
Then you should try to look for a job with this language. So you can learn more.
thank you cards
Hi I'm a beginner for c language, any free compiler on line?
haveing windows xp OS in my pc.
i want a link for c compiler for free...
Hi I'm a beginner for c language, any free compiler on line?
http://www.acms.arizona.edu/education/op...
Reply:You can use Turbo C Compiler.
It can be used for a beginning stage. And if you want to go further use GCC (In Linux) or You can get MinGW which is Minimal GCC for Windows. Try it out.
Reply:C++, The Borland C++ free Compiler #1 -...
The first line tells the C compiler to include the header file "iostream.h" ... I do not mind the "C" language per se, but...
cpp.codenewbie.com/articles/cpp/1452/....
The Borland C++ free Compiler #1 - Code...
The first line tells the C compiler to include the header file "iostream.h" ... I do not mind the "C" language per se, but...
codenewbie.com/forum/c/717-borland-c-f...
Free C/C++ Compilers and Interpreters -...
Pelles C Compiler ... applications you compile with this free compiler, but you should read their ... extensions to the C...
www.mycplus.com/forum/forum_posts.asp?...
Reply:download it from download.com bloodshed is good
Reply:no compilers are free...
but some are available on internet as pirated..u may download them..
some popular compilers are Turbo c,Borland C
Reply:I like Bloodshed Dev-C++, which is obviously a C++ IDE/compiler, but should do plain C code as well? It's free, anyway.
i want a link for c compiler for free...
Hi I'm a beginner for c language, any free compiler on line?
http://www.acms.arizona.edu/education/op...
Reply:You can use Turbo C Compiler.
It can be used for a beginning stage. And if you want to go further use GCC (In Linux) or You can get MinGW which is Minimal GCC for Windows. Try it out.
Reply:C++, The Borland C++ free Compiler #1 -...
The first line tells the C compiler to include the header file "iostream.h" ... I do not mind the "C" language per se, but...
cpp.codenewbie.com/articles/cpp/1452/....
The Borland C++ free Compiler #1 - Code...
The first line tells the C compiler to include the header file "iostream.h" ... I do not mind the "C" language per se, but...
codenewbie.com/forum/c/717-borland-c-f...
Free C/C++ Compilers and Interpreters -...
Pelles C Compiler ... applications you compile with this free compiler, but you should read their ... extensions to the C...
www.mycplus.com/forum/forum_posts.asp?...
Reply:download it from download.com bloodshed is good
Reply:no compilers are free...
but some are available on internet as pirated..u may download them..
some popular compilers are Turbo c,Borland C
Reply:I like Bloodshed Dev-C++, which is obviously a C++ IDE/compiler, but should do plain C code as well? It's free, anyway.
I need a text editor in c language alone pls help me out....?
tat should of pure c code ...
I need a text editor in c language alone pls help me out....?
I Think You Want The Source Code For A Text Editor,
Check This
http://www.programmersheaven.com/zone3/m...
If You Mean A Text Editor To Edit C Code
Check This
http://textpad.com/download/index.html
Anyway Your Anser Is, This Will Help ;-)
Reply:If you mean the source, write it. If you mean an executable text editor - you don't run C code, you run the .exe file the C code compiles to, so it doesn't matter what language it was written in.
I need a text editor in c language alone pls help me out....?
I Think You Want The Source Code For A Text Editor,
Check This
http://www.programmersheaven.com/zone3/m...
If You Mean A Text Editor To Edit C Code
Check This
http://textpad.com/download/index.html
Anyway Your Anser Is, This Will Help ;-)
Reply:If you mean the source, write it. If you mean an executable text editor - you don't run C code, you run the .exe file the C code compiles to, so it doesn't matter what language it was written in.
Help me in my program in C-Language !!! Please!!?
PROBLEM 1:The National Earthquake Information Center has the following criteria to determine the earthquake damages. Here is the given richter scale serve as an input data and the characterization as output information.
RICHTER NUMBER (N)....CHARACTERIZATION
N%26lt;5.0---------little or no damage
5.0%26lt;=N%26lt;5.5-----some damage
5.5%26lt;=N%26lt;6.5.---serious damage
6.5%26lt;=N%26lt;7.5----Disaster
Higher.---------Catastrophe
Solution: use the else if case conditional statement.
Problem 2:
Write a program in C for the Air force to label an aircraft a military or civilian.The program is to be given the plane's observed speed in km/h %26amp; its estimated length in meters.For plane travelling in excess of 1100km/h %26amp; longer than 52m, you should label them as"civilian"aircraft,%26amp; shorter such as 500 km/h %26amp; 20m as"military"aircraft. For planes travelling at more slower speeds,you will issue an "It's bird"message.
SOLUTION:use ladderized case conditional statement.
Help me in my program in C-Language !!! Please!!?
solution for first one:
#include%26lt;stdio.h%26gt;
void main()
{
float N;
printf("Enter the Ritcher number\n");
scanf("%2f",%26amp;N);
if(N%26lt;5.0)
printf("Little or no damage");
else if(N%26gt;=5.0 || N%26lt;5.5)
printf("Some damage");
else if(N%26gt;=5.5 || N%26lt;6.5)
printf("Serious damage");
else if(N%26gt;=6.5 || N%26lt;7.5)
printf("Disaster");
else
printf("Catastrophe");
}
RICHTER NUMBER (N)....CHARACTERIZATION
N%26lt;5.0---------little or no damage
5.0%26lt;=N%26lt;5.5-----some damage
5.5%26lt;=N%26lt;6.5.---serious damage
6.5%26lt;=N%26lt;7.5----Disaster
Higher.---------Catastrophe
Solution: use the else if case conditional statement.
Problem 2:
Write a program in C for the Air force to label an aircraft a military or civilian.The program is to be given the plane's observed speed in km/h %26amp; its estimated length in meters.For plane travelling in excess of 1100km/h %26amp; longer than 52m, you should label them as"civilian"aircraft,%26amp; shorter such as 500 km/h %26amp; 20m as"military"aircraft. For planes travelling at more slower speeds,you will issue an "It's bird"message.
SOLUTION:use ladderized case conditional statement.
Help me in my program in C-Language !!! Please!!?
solution for first one:
#include%26lt;stdio.h%26gt;
void main()
{
float N;
printf("Enter the Ritcher number\n");
scanf("%2f",%26amp;N);
if(N%26lt;5.0)
printf("Little or no damage");
else if(N%26gt;=5.0 || N%26lt;5.5)
printf("Some damage");
else if(N%26gt;=5.5 || N%26lt;6.5)
printf("Serious damage");
else if(N%26gt;=6.5 || N%26lt;7.5)
printf("Disaster");
else
printf("Catastrophe");
}
Some Interview Questions that I need solution in C language...?
1. Given 2 files, f1 and f2 with thousands of name each. Find the common names in the two files. Extend this to 3 files.
2. Algorithm to count most user viewed pages.
3. Code to find dot and cross product
4. Write a function that accepts a function pointer and check the procId of the calling process. Check if the process was alive at a specific interval. If yes, then invoke the function (pointed to by the function pointer) else return. Write another function that would take a request from the process to stop the first function
5. You have 50000 html files, some of which contain phone numbers. How would you create a list of all the files which contain phone numbers?
6. Write C code for 'tr' program.
C:\%26gt; tr abc xyz %26lt;file name%26gt;
replaces all occurances of a by x, b by y and c by z in %26lt;file name%26gt;
7. Given a sentence, find if a specific word occurs in it.
8. Write the data structure for jigsaw puzzle. Assume that there is some method which can tell if 2 pieces fit tog
Some Interview Questions that I need solution in C language...?
Dude, you can't get a job by asking solution to problems. Atleast try solving them and then you can ask your doubts one at a time.
No one will solve all these problems from scratch. You need to do some work at your end.
potential breakup song
2. Algorithm to count most user viewed pages.
3. Code to find dot and cross product
4. Write a function that accepts a function pointer and check the procId of the calling process. Check if the process was alive at a specific interval. If yes, then invoke the function (pointed to by the function pointer) else return. Write another function that would take a request from the process to stop the first function
5. You have 50000 html files, some of which contain phone numbers. How would you create a list of all the files which contain phone numbers?
6. Write C code for 'tr' program.
C:\%26gt; tr abc xyz %26lt;file name%26gt;
replaces all occurances of a by x, b by y and c by z in %26lt;file name%26gt;
7. Given a sentence, find if a specific word occurs in it.
8. Write the data structure for jigsaw puzzle. Assume that there is some method which can tell if 2 pieces fit tog
Some Interview Questions that I need solution in C language...?
Dude, you can't get a job by asking solution to problems. Atleast try solving them and then you can ask your doubts one at a time.
No one will solve all these problems from scratch. You need to do some work at your end.
potential breakup song
How can i write a c language program to determine whether 4 digits are palindrome or no?
please help just by telling me how can i define palindrome in C program, i don't want the whole program.
How can i write a c language program to determine whether 4 digits are palindrome or no?
If you are only worried about 4 digits then:
If variable s is the 4 digit string
If (s[0] is equal to s[3]) and (s[1] is equal to s[2]) then it is a 4 digit palindrome.
Use your knowledge of C to implement this suedo code.
==Edit==
* Sheqi actually has an elegant solution (I gave it a thumbs up) but reversing the 4 digit is an extra step you don't need.
* richarduie has an example of what I said.
* I'm not sure what Alexanders code does without tracing it. It might work if when you said "digits" you meant numbers but I would trace it before I handed that one in.
* Curious George has some C++ code so don't copy that verbatim to answer your "C" question. It will just raise eyebrows.
Reply:This will work for any number of type "int":
int a = /*needed number*/;
int x = 0;
int z = a;
while (z)
{
x *= 10;
x += z%10;
z /= 10;
}
if (x==a)
{
/*number is a palindrome*/
}
else
{
/*number isn't a palindrome*/
}
Reply:bool isPalindrome(const std::string %26amp;str)
{
std::string::const_reverse_iterator itEnd = str.rbegin()++;
for (std::string::const_iterator itStart = str.begin(); itStart %26lt; itEnd.base(); ++itStart, ++itEnd)
{
if (*itStart != *itEnd)
{
return false;
}
} return true;
}
Reply:For a four-digit number, break the number into digits. For instance, 5678 would decompose into 5, 6, 7, 8. Compare the first and last for equality. Compare the second and third for equality. If both pairs are equal, the number is palindromic.
E.g.,
2452 --%26gt; (2 == 2) %26amp;%26amp; (4 == 5) --%26gt; true %26amp;%26amp; false --%26gt; false
3663 --%26gt; (3 == 3) %26amp;%26amp; (6 == 6) --%26gt; true %26amp;%26amp; true --%26gt; true
2452 is not a palindormic number; 3663 is.
Reply:A palindrome is a word, phrase, number or other sequence of units that has the property of reading the same in either direction.
Reverse the order of the string and compare with the original.
How can i write a c language program to determine whether 4 digits are palindrome or no?
If you are only worried about 4 digits then:
If variable s is the 4 digit string
If (s[0] is equal to s[3]) and (s[1] is equal to s[2]) then it is a 4 digit palindrome.
Use your knowledge of C to implement this suedo code.
==Edit==
* Sheqi actually has an elegant solution (I gave it a thumbs up) but reversing the 4 digit is an extra step you don't need.
* richarduie has an example of what I said.
* I'm not sure what Alexanders code does without tracing it. It might work if when you said "digits" you meant numbers but I would trace it before I handed that one in.
* Curious George has some C++ code so don't copy that verbatim to answer your "C" question. It will just raise eyebrows.
Reply:This will work for any number of type "int":
int a = /*needed number*/;
int x = 0;
int z = a;
while (z)
{
x *= 10;
x += z%10;
z /= 10;
}
if (x==a)
{
/*number is a palindrome*/
}
else
{
/*number isn't a palindrome*/
}
Reply:bool isPalindrome(const std::string %26amp;str)
{
std::string::const_reverse_iterator itEnd = str.rbegin()++;
for (std::string::const_iterator itStart = str.begin(); itStart %26lt; itEnd.base(); ++itStart, ++itEnd)
{
if (*itStart != *itEnd)
{
return false;
}
} return true;
}
Reply:For a four-digit number, break the number into digits. For instance, 5678 would decompose into 5, 6, 7, 8. Compare the first and last for equality. Compare the second and third for equality. If both pairs are equal, the number is palindromic.
E.g.,
2452 --%26gt; (2 == 2) %26amp;%26amp; (4 == 5) --%26gt; true %26amp;%26amp; false --%26gt; false
3663 --%26gt; (3 == 3) %26amp;%26amp; (6 == 6) --%26gt; true %26amp;%26amp; true --%26gt; true
2452 is not a palindormic number; 3663 is.
Reply:A palindrome is a word, phrase, number or other sequence of units that has the property of reading the same in either direction.
Reverse the order of the string and compare with the original.
Can we connect database in 'C' language?
i need to connect a database in a C program and i have to enter the data in the database and retrieve it in runtime
Can we connect database in 'C' language?
Unix platform? What database?
Update: Why use C for this? Access has its own (VB-based) GUI. If you have to use C, you need the C API for MS-Access. Are you using a Visual C tool?
Reply:Almost any language can be used to connect to any database, so yes, you can connect to an Access database with C. I'd suggest using an ODBC connection (see the link for connection strings - Access 2007 is 2007 and later).
Can we connect database in 'C' language?
Unix platform? What database?
Update: Why use C for this? Access has its own (VB-based) GUI. If you have to use C, you need the C API for MS-Access. Are you using a Visual C tool?
Reply:Almost any language can be used to connect to any database, so yes, you can connect to an Access database with C. I'd suggest using an ODBC connection (see the link for connection strings - Access 2007 is 2007 and later).
How can I get fully knowledge about c++ language(object oriented language),tell me the good sites for this?
computer language forcomputer students
How can I get fully knowledge about c++ language(object oriented language),tell me the good sites for this?
Hi Try some books!
Search C++ e books on this link
http://www.esnips.com/_t_/
BEst way of learning things is to play with it. try removing and adding and manupalating thing! And i think u will learn language. Consult books
Reply:A little more work and you can get a B-, give it a try.
Reply:www.bigbanyantree.com
How can I get fully knowledge about c++ language(object oriented language),tell me the good sites for this?
Hi Try some books!
Search C++ e books on this link
http://www.esnips.com/_t_/
BEst way of learning things is to play with it. try removing and adding and manupalating thing! And i think u will learn language. Consult books
Reply:A little more work and you can get a B-, give it a try.
Reply:www.bigbanyantree.com
Question about a program in C language,?
can someone give me d code to print d following series in C.
1
2 2
3 3 3
.
.
.
.
and so on...........
i actualy want it in form of a tree.
1 in d centre, 2 on either side of 1 on next line and hence......
Question about a program in C language,?
#include %26lt;stdio.h%26gt;
int main(void)
{
//represents the row
for(int i=0;i%26lt;10;i++){
//puts spaces in that aligns to the right side
if(i!=0){
for(int p=0;p%26lt;i;p++){
printf(" ");
}
}
//draws the numbers in column
for(int k=10-i;k%26gt;0;k--){
printf("%d",k);
}
//new line
printf("\n");
return 0;
}
Reply:This so-called "best answer" didn't even compile! So to even suggest that this was the best answer is ridiculous. Report It
Reply:for(L=1; L%26lt;=3; L++)
{
for(i=1; i%26lt;=40-L; i++)
printf(" ");
for(j=1, x=1; j%26lt;=2*L; j++,x++)
printf("%d",x);
}
try that.. ijust freehanded it.. i dont really know if it works..
just modify it if there are problems..you can do it..
Reply:Ok, I am going to mark this "interesting". It strikes me that we want as simple a solution as possible, as long as it works in standard (ANSI) C. Here goes:
#include %26lt;stdio.h%26gt;
/* Width of output */
#define W 80
/* Maximum count */
#define M 10
/* Generate i repetitions of character c, returning a string */
char *reps(int i, char c, char *buf)
{
buf[i] = '\0';
while (i) buf[--i] = c;
return buf;
}
int main(void)
{
int i;
char buf[M];
/* We use the * format option to choose field width, and
this is used to center the line. reps() is used to generate
the output data. */
for (i = 1; i %26lt; M; ++i) printf("%*s\n",(W + i) / 2, reps(i, '0' + i, buf));
return 0;
}
This works -- with the caveat that the even strings are always offset from the odd length strings (we can't print 1/2 of a character).
Another solution is to use two printf()'s. The first would generate a null string with padding to the length of the select string. Then, we replace the padding spaces with the target character, and printf() the result with padding to effect the desired centering. We still need to scan the print string for the replacement, so it ends up being more complex than this code. Or, we could use counters, and putc()...
Reply:Here you go (this one actually works) but your prof will never believe you came up with this on your own. :-)
//////////////////////////////////////...
#include %26lt;string.h%26gt;
#include %26lt;stdio.h%26gt;
#define MAXNUM 20
int main(int argc, char **argv)
{
int i, j;
char numbuf[3] = {0x30, 0x20, 0};
char outbuf[MAXNUM * 2 + 1];
char padbuf[MAXNUM * 2];
// calc what the width from left edge to center
// will be for the bottom row
int basewidth = (MAXNUM * 2) - 1;
// fill padding buffer with spaces, to
// longest length needed
for (i = 0; i %26lt; MAXNUM * 2; i++)
padbuf[i] = 0x20;
for (i = 1; i %26lt; MAXNUM + 1; i++)
{
// add 0x30 to last digit of iterator
// to get ascii value of chars '1' - '0'
numbuf[0] = (i % 10) + 0x30;
// truncate output buffer
outbuf[0] = 0;
// fill output buffer with repetition of number
// buffer
for (j = 0; j %26lt; i; j++)
strcat(outbuf, numbuf);
// shorten the padding buffer by null-terminating
// it at the correct length for this level
padbuf[basewidth - ((i * 2) - 1)] = 0;
printf("%s%s%s\r\n", padbuf, outbuf, %26amp;outbuf[2]);
}
return (0);
}
love song
1
2 2
3 3 3
.
.
.
.
and so on...........
i actualy want it in form of a tree.
1 in d centre, 2 on either side of 1 on next line and hence......
Question about a program in C language,?
#include %26lt;stdio.h%26gt;
int main(void)
{
//represents the row
for(int i=0;i%26lt;10;i++){
//puts spaces in that aligns to the right side
if(i!=0){
for(int p=0;p%26lt;i;p++){
printf(" ");
}
}
//draws the numbers in column
for(int k=10-i;k%26gt;0;k--){
printf("%d",k);
}
//new line
printf("\n");
return 0;
}
Reply:This so-called "best answer" didn't even compile! So to even suggest that this was the best answer is ridiculous. Report It
Reply:for(L=1; L%26lt;=3; L++)
{
for(i=1; i%26lt;=40-L; i++)
printf(" ");
for(j=1, x=1; j%26lt;=2*L; j++,x++)
printf("%d",x);
}
try that.. ijust freehanded it.. i dont really know if it works..
just modify it if there are problems..you can do it..
Reply:Ok, I am going to mark this "interesting". It strikes me that we want as simple a solution as possible, as long as it works in standard (ANSI) C. Here goes:
#include %26lt;stdio.h%26gt;
/* Width of output */
#define W 80
/* Maximum count */
#define M 10
/* Generate i repetitions of character c, returning a string */
char *reps(int i, char c, char *buf)
{
buf[i] = '\0';
while (i) buf[--i] = c;
return buf;
}
int main(void)
{
int i;
char buf[M];
/* We use the * format option to choose field width, and
this is used to center the line. reps() is used to generate
the output data. */
for (i = 1; i %26lt; M; ++i) printf("%*s\n",(W + i) / 2, reps(i, '0' + i, buf));
return 0;
}
This works -- with the caveat that the even strings are always offset from the odd length strings (we can't print 1/2 of a character).
Another solution is to use two printf()'s. The first would generate a null string with padding to the length of the select string. Then, we replace the padding spaces with the target character, and printf() the result with padding to effect the desired centering. We still need to scan the print string for the replacement, so it ends up being more complex than this code. Or, we could use counters, and putc()...
Reply:Here you go (this one actually works) but your prof will never believe you came up with this on your own. :-)
//////////////////////////////////////...
#include %26lt;string.h%26gt;
#include %26lt;stdio.h%26gt;
#define MAXNUM 20
int main(int argc, char **argv)
{
int i, j;
char numbuf[3] = {0x30, 0x20, 0};
char outbuf[MAXNUM * 2 + 1];
char padbuf[MAXNUM * 2];
// calc what the width from left edge to center
// will be for the bottom row
int basewidth = (MAXNUM * 2) - 1;
// fill padding buffer with spaces, to
// longest length needed
for (i = 0; i %26lt; MAXNUM * 2; i++)
padbuf[i] = 0x20;
for (i = 1; i %26lt; MAXNUM + 1; i++)
{
// add 0x30 to last digit of iterator
// to get ascii value of chars '1' - '0'
numbuf[0] = (i % 10) + 0x30;
// truncate output buffer
outbuf[0] = 0;
// fill output buffer with repetition of number
// buffer
for (j = 0; j %26lt; i; j++)
strcat(outbuf, numbuf);
// shorten the padding buffer by null-terminating
// it at the correct length for this level
padbuf[basewidth - ((i * 2) - 1)] = 0;
printf("%s%s%s\r\n", padbuf, outbuf, %26amp;outbuf[2]);
}
return (0);
}
love song
What are the benefits of c language can u tell me plz?
means what are the advantages of c lang
What are the benefits of c language can u tell me plz?
C is very imp language dis days...it is user friendly and very easy to learn...
C is very simple as compared to other languages such as JAVA...bcoz in C there r very less functions which r very simple to use.....
moreover if ur interested in aeronautics sort of stuffs dan C is must.....bcoz in the programming of shuttle and robots scientists use C language
recent robot which was sent to mars was programed by C
so u see its imp and rather interesting also.......
Reply:it has no advantages over assembly, sry
Reply:what is c language?
Reply:what is c?
Reply:If you are asking about C programming language, you are in the wrong section.
What are the benefits of c language can u tell me plz?
C is very imp language dis days...it is user friendly and very easy to learn...
C is very simple as compared to other languages such as JAVA...bcoz in C there r very less functions which r very simple to use.....
moreover if ur interested in aeronautics sort of stuffs dan C is must.....bcoz in the programming of shuttle and robots scientists use C language
recent robot which was sent to mars was programed by C
so u see its imp and rather interesting also.......
Reply:it has no advantages over assembly, sry
Reply:what is c language?
Reply:what is c?
Reply:If you are asking about C programming language, you are in the wrong section.
How to save records in C language & effective way to retrieve them up?
in C i am making a project in which I have to save the date %26amp; occasion related to that day
I want to know how I can effectively store this record?
in future i have to retrieve it also?
please help..............
How to save records in C language %26amp; effective way to retrieve them up?
Try something like:
/* fopen example */
#include %26lt;stdio.h%26gt;
int main ()
{
FILE * pFile;
pFile = fopen ("myfile.txt","w");
if (pFile!=NULL)
{
fputs ("fopen example",pFile);
fclose (pFile);
}
return 0;
}
Reply:A database seems like the logical choice. However you could just as easily store the information in a flat text file.
I want to know how I can effectively store this record?
in future i have to retrieve it also?
please help..............
How to save records in C language %26amp; effective way to retrieve them up?
Try something like:
/* fopen example */
#include %26lt;stdio.h%26gt;
int main ()
{
FILE * pFile;
pFile = fopen ("myfile.txt","w");
if (pFile!=NULL)
{
fputs ("fopen example",pFile);
fclose (pFile);
}
return 0;
}
Reply:A database seems like the logical choice. However you could just as easily store the information in a flat text file.
Subscribe to:
Posts (Atom)