#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int comp_nums(const int *num1, const int *num2)
{
if (*num1 < *num2) return -1;
if (*num1 == *num2) return 0;
if (*num1 >...
Type: Posts; User: winsonlee
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int comp_nums(const int *num1, const int *num2)
{
if (*num1 < *num2) return -1;
if (*num1 == *num2) return 0;
if (*num1 >...
read(int d, void *buf, size_t nbytes);
How can i use the above function to read a file and store the content of the file in char variable ??? I have got the buffer size already. But i dont know...
How can i write to a piece of memory address ??
lets say i would like to write a to a memory location at 10034, how can i archieve this ??
#include <string>
void
Calc::yyerror(const char * mesg) {
string x;
// how can i make this to work ??? I would like to copy the mesg to the x string.
x = mesg;
There are three classes which name Plus, Mult and Constant. How can i make in such a way that the Mult class has a method that holds the 5 and 4 object which is created earlier and the Plus class has...
But i thought i can create a bbb object and pass it to the aaa constructor ???
I tried the following code but i couldnt figure out why does the error occurs. Can someone let me know whats wrong with this code ??
class Expression {
public:
Expression() { }
virtual...
does it works just like how char *data works ???
char comes with c language it self. But Expression and Variable comes from where ??? Is it from a class?? Coz AssXX class and Variable is the...
class AssXX:public Expression{
private:
Expression * lhs;
Variable * rhs;
};
What does the Expression and Variable for the AssXX class means ??
sfmttime( str, sizeof(str)-1,
"1) It's %A, %B %d\n", &today );
I tried using the following function to store the string into str but i got the following error msg
Message.cpp: In...
how can i get the time and the date from the pc and store it in variable ???
eg :
i wan to assign the current time which is 4.15pm to timex variable and 19/08/2004 which is today's date to...
The problem is both the string is from the standard input. So i cant declare string as string[]. My second problem is the name after ">" always change. Sometimes it can be file1 sometimes it can be...
char *string = "Hello how are you doing > file";
char *string2 = "hello > file how are you doing";
I wanted to to store the information in string one as
char *stringx = "Hello how are you...
char *cdx[2];
cdx[1]="/home/dir";
How can i know if the first character is start with "/" or not ??
if first char == "/" then
return 0;
The following code is to store integer in a link list. How can i modify it so that it is able to store objects in a link list ? For your information, i am not asking solution directly for my...
main.cpp
LogMessage logM();
Message m("hello world");
Message mx("hello world");
logM.log(m);
logM.log(mx);
private:
string mySender;
string temp;
mySender and temp declared as string. I still couldnt figure out whats wrong with my following code ??
string Message::getMessage() const {
char hello[]= "main(int";
How can i extract the "int" from the hello string??
I know the length of the string which is 8 and i know that the "(" start in position 5. From there, how can i proceed...
How can i count the number of symbols found in C-code in filex.c ??
eg:
while 1
( 3
) 3
} 1
{ 1
How can i make in such a way that the negative is ignored before adding up the number ??
Eg: I want the following the code to print out 13 instead of -1.
double hello[]={-1,2,4,-6};
...
When i tried using the strlen inside the for loop, it gives me the following warning msg. I would like to know why this happend ??
"warning C4018: '<' : signed/unsigned mismatch"
for(i=1;...
x = 2/4;
printf("%f", x);
Output:
0.00000
How can 2/4 result is 0.000 ?? How can i make the output so that it is 0.5
i know whats wrong already. I didnt declare the size of the array.
Thanks anyway..
May i know whats wrong with this code ?? There isn't any error while compiling. But when i try to build the file that time, it display the following error
"Linking...
prac3a.obj : error...
If i use the first option, when i wanted to print that time, woudlnt it be ..?
printf("%s", array[0]); // john
printf("%s", array[1]); // 45
printf("%s", array[2]); // darwin
printf("%s",...