Search Results

Showing results 1 to 40 of 50
Search took 0.03 seconds.
Search: Posts Made By: andor
Forum: C++ May 16th, 2007
Replies: 2
Views: 5,400
Posted By andor
Your problem is not to convert int to char if I'm correct. You only need to check the input with

int isdigit(int character);

link (http://www.acm.uiuc.edu/webmonkeys/book/c_guide/2.2.html)
Forum: C Feb 9th, 2007
Replies: 3
Solved: C file stream
Views: 5,547
Posted By andor
Yes. With fopen, SEEK_END and ftell you can determine the size of file and after SEEK_SET read the the whole file with fread.


#include <stdio.h>
#include <stdlib.h>

int main()
{
char *...
Forum: C Jan 26th, 2007
Replies: 2
Solved: New
Views: 914
Posted By andor
I'm not shore that I understood your problem.

#if 0
/* you can put here anything and the compiler wouldn't consider it */
#else
/* while this part will be considered */
#endif /* if 0 */
Forum: C Nov 22nd, 2006
Replies: 9
Views: 1,679
Posted By andor
#include <stdio.h>
#include <string.h>

int one_less(char *);
int main()
{
char s[20];
printf("Type string\n");
scanf("%s", s);
printf("number of changes made is...
Forum: C Nov 21st, 2006
Replies: 9
Views: 1,679
Posted By andor
With something like this:

if ((a[i] > '0') && (a[i] <='9'))
{
a[i] -= 1;
}

In the loop.
One remark about your code. You are not obtaining the string the right way. Read this...
Forum: C++ Nov 3rd, 2006
Replies: 3
Views: 2,539
Posted By andor
You made a little mistake with your link. No big deal just test it and U will understand :)
Forum: C Oct 27th, 2006
Replies: 2
Views: 3,559
Posted By andor
Variable answer is float not int. Instead of printf("%d",answer); use printf("%f",answer); instead. Dont use nonstandard func (use them only if your teacher explicitly demanded). You need a getchar...
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
Ok while U're here just to report that the posts order are different for internet explorer and for firefox.
EDIT: is that a bug?
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
WHAT!?!? Okay use this

int main()
{
/* your code going here */
return 0;
}
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
Ah nice didn't know that it exist ([code=c]). :sad:
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
Um you need a main func. Where did you declared the age variable?

do
{
/* stuff */
} while(/*your code going here */);

This is a do while loop, not

do
Forum: C Oct 25th, 2006
Replies: 12
Solved: Gone Loopy in C
Views: 1,978
Posted By andor
Did you copile this? Use [ CODE] [ /CODE] tags.
Forum: C Oct 25th, 2006
Replies: 6
Views: 1,597
Posted By andor
Also you can do it with string.

len = sprintf(buff, "%d", num);

for (i=0; i<len; i++)
{
printf("%d\n", buff[i] - '0');
}

Where num is in your case 1567.
Forum: C Oct 20th, 2006
Replies: 14
Views: 4,557
Posted By andor
Declare the both globals as locals inside the main func.

int transfer_sequence (char * initial_sequence, char * fix_sequence);
int check_gene (char * fix_sequence);
int main()
{
char...
Forum: C Oct 19th, 2006
Replies: 14
Views: 4,557
Posted By andor
If you using scanf than:
input: G (hit enter) X (hit enter) your output GX
If using getchar
input: GX your output GX.

#include <stdio.h>

int main()
{
int sequencetemp;
Forum: C Oct 18th, 2006
Replies: 2
Solved: void pointer
Views: 3,060
Posted By andor
What part U dont understand? The void pointer? Well void pointer can be used if you are not shore which type will be passed to func compare.
BTW const void must be separated.
Forum: C Oct 18th, 2006
Replies: 14
Views: 4,557
Posted By andor
sorry I didn't read your post carefully. I asume that U must use scanf, so then U must. Ok the problem is your loop. Dont increment x every time.
Check this

for ( x = 0; x < 511; ) { /* x < 511...
Forum: C Oct 18th, 2006
Replies: 14
Views: 4,557
Posted By andor
For obtaining single char you can use getchar which returns int. You can read this (http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044652485&id=1043284385) and this...
Forum: C++ Oct 13th, 2006
Replies: 3
Views: 3,331
Posted By andor
This is not enoughf information. Post your code.
Forum: C Oct 8th, 2006
Replies: 2
Solved: until help
Views: 774
Posted By andor
No it dose not exist. Replace it with

do
{
/* your code going here */
} while(a<b);
Forum: C Oct 6th, 2006
Replies: 19
Views: 3,884
Posted By andor
Convert cust_num to string for example with sprintf.

char buff[MAX];
sprintf(buff, "%d", cust_num);
fputs(buff, fpr);
/* and for fputc */
fputc(cust_num + '0', fpr); /* suposing that cust_num...
Forum: C Oct 5th, 2006
Replies: 19
Views: 3,884
Posted By andor
It means how many of size_t_Size you want to write.
fwrite(buff, sizeof(int), 4, someFile) means you want to write four ints to file.
Forum: C Sep 30th, 2006
Replies: 10
Solved: need some help
Views: 2,291
Posted By andor
Use code tags (http://www.daniweb.com/techtalkforums/announcement8-3.html) and don't use void main (read this (http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376))
Forum: C++ Sep 29th, 2006
Replies: 6
Views: 4,673
Posted By andor
Change the constructor to

rectangle()
{
length = 1;
width = 1;
} //constructor sets length and width defaults to 1

or
Forum: C++ Sep 29th, 2006
Replies: 6
Views: 4,673
Posted By andor
Hm never seen that (probably becouse I'm not c++ programmer). But the book never lies. Make a test just leave the construtor and what will the copiler tell U
Forum: C++ Sep 29th, 2006
Replies: 6
Views: 4,673
Posted By andor
Yuo should run throught tutorial. You should know the diffrence from set and get. For example

float getLength(float)
{
float Len;
cout << "Enter the length: ";
cin...
Forum: C Sep 29th, 2006
Replies: 10
Solved: need some help
Views: 2,291
Posted By andor
With which part do you have problem? Formula for conversion or programming issue? For formulas, read this (http://www.google.com/search?hl=en&lr=&q=formula+temperature+conversion&btnG=Search). For...
Forum: C++ Sep 27th, 2006
Replies: 6
Views: 2,810
Posted By andor
And the question is?
Forum: C Sep 26th, 2006
Replies: 5
Views: 2,563
Posted By andor
>error C2061: syntax error : identifier 'scanf'
it means you need ( before scanf.
>I still have to figure out why my average value is coming out wrong.
Did U read my post?
>What would be the best...
Forum: C Sep 26th, 2006
Replies: 5
Views: 2,563
Posted By andor
You are not calculating the total gallons after first gallon input before while, and after finishing the prog you are substacting from total gallons -1.
Forum: C++ Sep 25th, 2006
Replies: 6
Views: 1,843
Posted By andor
Did you tried cin.ignore after cin.get(ifname, 150); ?
Forum: C++ Sep 20th, 2006
Replies: 5
Solved: Check Please!
Views: 1,442
Posted By andor
Why don't you use the compiler to check the code. Do you have question?
check.cpp: In function `bool checker(int)':
check.cpp:19: warning: control reaches end of non-void function
Thats after my...
Forum: C Sep 11th, 2006
Replies: 3
Solved: C Quest 2
Views: 1,029
Posted By andor
#include <stdio.h>
#include <stdlib.h>

int func();

int main()
{
short mat[3][3],i,j;

for(i = 0 ; i < 3 ; i++)
Forum: C++ Sep 5th, 2006
Replies: 6
Views: 22,532
Posted By andor
I don't think that someone will provide you the source code. Try at google. I bet that you will find something
Forum: C Sep 1st, 2006
Replies: 3
Views: 1,317
Posted By andor
First of all fflush(stdin);won't do the work!
Read this (http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044873249&id=1043284392) and this...
Forum: C Aug 28th, 2006
Replies: 15
Views: 4,281
Posted By andor
#include <iostream>
#include <cstdlib>
#include <string>

using namespace std;
void decToBin(int number, int base);
int numOnes = 0;

int main()
{
Forum: C Aug 28th, 2006
Replies: 15
Views: 4,281
Posted By andor
Ok here it is

for (unsigned int i=0; i<name.size(); i++)
{
cout << name[i] << " binary (";
decToBin(name[i], 2);
cout << ")" << endl;

char tmp[2] = { 0, 0...
Forum: C Aug 24th, 2006
Replies: 15
Views: 4,281
Posted By andor
A litle of help. In your for loop you can make a temp array wich will convert the name[i] to decimal with atoi.

char tmp[2] = { 0, 0 };
tmp[0] = name[i];
answer = atoi(tmp);


Figure this out
Forum: C Aug 24th, 2006
Replies: 15
Views: 4,281
Posted By andor
This is illegal. What did you want with this line?
Forum: C++ Aug 21st, 2006
Replies: 2
Views: 1,713
Posted By andor
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
void decToBin(int number, int base);
int main()
{
cout<<"Enter a string: ";
string name;
...
Showing results 1 to 40 of 50

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC