hi,
It seems that there are a number of errors placed in the code to help you to understand what your instructor is trying to teach you. If you are not sure of what you are doing, try doing the following.
1. place comments arround the class object that is being called.
2. In main, place a comment arround the instantiation of the object in step 1.
3. compile the code and fix the errors.
4. run the...
User Profile
Collapse
-
Hi,
try these changes to your code.
#include <stdio.h>
int main() {
FILE *fi;
float val, maximum = 0, minimum = 0, sum=0.0;
int i, n=10;
if ( (fi=fopen("rain fall.dat","r")) == NULL ) {
fprintf(stderr, "ERROR opening file!\n"); return 1; }
fscanf(fi,"%f", &val);
while ( (val >= 0 ) &&...Leave a comment:
-
hi,
try the following:
change if (isdigit(tokena rray[1]) != 0)
to if (isdigit(*token array[1]) != 0)
regards,
andersodLeave a comment:
-
hi,
try
#define __cpp_stdc
#include <stdio.h>
#include <unistd.h>
void SLEEP(int x)
{
sleep(x);
}
int main() {
printf("line 1\n");
fflush(stdout);
SLEEP(10);
printf("line 1\n");
fflush(stdout);
return(0);
}Leave a comment:
-
Hi,
I get the same message except that it says "string" instead of "String".
I opened a ticket with IBM and they are looking into it. I will add that information here after it is resolved.
Thanks.Leave a comment:
-
hi,,
you could also do the following:
char ch[]={'A','B','C'};
int i;
for(i=0; i<3;i++) {
int val = (int)ch[i];
printf("charact er %c integer value %d\n", ch[i], val);
}
desmondLeave a comment:
-
hi,
You said in you initial statement that the language is c. I assumed you wanted c version.
Anyway, it does not matter. "void *" takes anything. This allows you to store and retrieve any data type that you want by type casting it when storing, retrieving, allocating,and distroying the memory area. "void *" gives you more control of you datatypes.
It also works perfectly in c++. I am also...Leave a comment:
-
Hi,
Try defining the array variable as type void, then typecast it to the different types.
ex.
#include <stdio.h>
#include <stdlib.h>
int main(){
void *x = NULL;
x = (int *)1;
printf("the value is %d\n",(int *)x);
x = (char *)'A';
printf("the character is %c\n",(char*)x) ;
}
result:
the value...Leave a comment:
-
AIX xlC compiler v8.0 auto_ptr
Hi,
I am migrating to an AIX platform and I have the following sample code.
#include <stdio.h>
#include <string>
#include <memory>
int main() {
auto_ptr<String > pl = new String;
pl->assign((char *)"Hello World");
printf("%s\n",( char *)pl->c_str());
}
I tried compiling using the following:...
No activity results to display
Show More
Leave a comment: