• Member Avatar for Banfa
    Banfa

    Replied To a Post in LCD interfce problem.

    This code appears to lack design additionally it appears to have C++ elements but you have posted it into the C forum. If I was going to pick on 1 …
  • Member Avatar for Banfa
    Banfa

    Began Watching Reverse Number In C

    #include <stdio.h> Reverse Number In C Program int main() { int n, reverse = 0; printf("Enter a number to reverse\n"); scanf("%d",&n); while (n != 0) { reverse = reverse * …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Reverse Number In C

    What is your question, your code seems to do what is intended?
  • Member Avatar for Banfa
    Banfa

    Began Watching reverse the string

    #reverse the string
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in reverse the string

    The question does not seem to preclude the use of a human processor so how about #include <string> #include <iostream> int main() { std::string text; std::string reversed; std::cout << "Please …
  • Member Avatar for Banfa
    Banfa

    Began Watching C++ input method

    How i take a full expration from user as input in c++ programme like (2+7 or 7*8 )
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in C++ input method

    You take it in as a string and then parse it into its constituent parts and interpret it. std::string expression std::getline(cin, expression); // Parse string here
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in CreateProsess problem

    This is slightly stretching my, now 10 year out of date, recolection of WIN API programming but ... I do not think GetStdHandle is likely to do what you want …
  • Member Avatar for Banfa
    Banfa

    Began Watching pass array to another file -> multiple definition of

    I want to pass an array from one cpp file to another. first: void wrapper(float **A,int N){ N=2; printf("Allocating Matrices\n"); *A = (float*)malloc(N*N*sizeof(float)); for(int i = 0; i < N; …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in pass array to another file -> multiple definition of

    Well you code compiles and links for me with exactly the commands you have given with the sole addition of #includes of cstdio and cstdlib to the top of your …
  • Member Avatar for Banfa
    Banfa

    Began Watching CreateProsess problem

    I am wrapping the Windows API CreateProcess. Here is my code. int __stdcall _Execute(LPTSTR program, LPTSTR workingdir, WORD show){ // Check if program has content if (!program || !*program){ MessageBox(NULL, …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in CreateProsess problem

    If you want to run a command in a command prompt you need to use the /c or /k switches before the command line, i.e. `"C:\Windows\System32\cmd.exe /c ping google.co.uk"` Try …
  • Member Avatar for Banfa
    Banfa

    Created DaniWeb down for a while there?

    So was I the only person for who DaniWeb was offline between 10am - 12noon UTC? Or have I missed a downtime notice somewhere?
  • Member Avatar for Banfa
    Banfa

    Began Watching DaniWeb down for a while there?

    So was I the only person for who DaniWeb was offline between 10am - 12noon UTC? Or have I missed a downtime notice somewhere?
  • Member Avatar for Banfa
    Banfa

    Began Watching Vector is different for every class instance!

    Okay so I have a class `Student`, which takes a number and a vector as a parameter for the constructor. Everything works well, until I output the values of the …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Vector is different for every class instance!

    The actual code causing the problem is in line 84 - 90 of your code. Note that the solutions suggested so far would fix this because they would force you …
  • Member Avatar for Banfa
    Banfa

    Began Watching prime numbers

    create a program to print all prime numbers between 1 to 100.
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in prime numbers

    It should be noted that for finding primes between in the range 1 - 100 any of the sieves are overkill of a high order. > since 1 is prime …
  • Member Avatar for Banfa
    Banfa

    Began Watching How is the weather today in your country?

    How is your weather in your country? I am living in the Philippines and the weather here today is stormy and according to news, we are overloaded of typhoons in …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in How is the weather today in your country?

    > Yeah, you Europeans get the warm ocean current smashing on your coasts, while we get it on its way back from Greenland! Yes and it's that warm ocean current …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Pointer Typecasting: Problem with float.

    It is not cast to a float type because it is not a float type, since the type of `p` is `char*` the type of `*p` is char. This is …
  • Member Avatar for Banfa
    Banfa

    Began Watching Size Of Structure.

    Hi guys, here is my code for sizeof() problem. #include<stdio.h> struct student{ char name[30]; int roll_no; float marks; }; int main(){ struct student s; printf("\nSize of Name: %d Bytes.", sizeof(s.name)); …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Size Of Structure.

    There are a couple of negative implications. Firstly if you compile and run a program on 1 machine that writes a structure directly to a file in binary form using …
  • Member Avatar for Banfa
    Banfa

    Began Watching Pointer help

    I am trying do this pratice but some how the 2nd function did return. P.S>>Since english is my first lang. can some one explane to me this is right path …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Pointer help

    You have 2 problems and 1 unecessary variable. The unecessary variable is being because the one place you use it, line 30, you could simply use index+1. U think this …
  • Member Avatar for Banfa
    Banfa

    Began Watching Pointer Typecasting: Problem with float.

    Hello folks, here is my code with question in it. #include<stdio.h> int main(){ float c=10.0001; char *p; p=(char *)&c; // Casting is correctly done. What exactly is purpose of (char …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Pointer Typecasting: Problem with float.

    The `(char *)` is the cast command it tells the compiler what cawst you wish to make, in this case float\* to char\*. Note that casts of this type are …
  • Member Avatar for Banfa
    Banfa

    Began Watching Big Oh notation of two non nested loops

    This is my question and I've managed to bring out an answer for part a, but for part b I'm not really confident about my answer of part b. In …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Big Oh notation of two non nested loops

    Personally I would ignore "(a Big-Oh answer will do)" and give an exact answer. You have the formula for fine after n days fine = 2^(2^(n-1)) The second question is …
  • Member Avatar for Banfa
    Banfa

    Began Watching Array name as Pointer variable.

    I have two questions: 1) Here is a small program showing how one can use Array name as Pointer variable. #include<stdio.h> int main(){ int a[5]={1,2,3,4,5},i=0; for(i=0; i<5; i++){ printf("\nAddress: %d\tValue: …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Array name as Pointer variable.

    An arry variable does not "point" at anything, it is an array with assigned memory and the properties of an array. On of the properties of an array is that …
  • Member Avatar for Banfa
    Banfa

    Began Watching Problem with storing strings in 2d arrray

    Hi there I am currently teaching myself C and I have to create a program with a 2d array that receives upto 5 names and prints them out. No pointers …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Problem with storing strings in 2d arrray

    Think about what you are doing, inputing a 1 x 5 array of strings. The first question is is that what you really meant because an array index with a …
  • Member Avatar for Banfa
    Banfa

    Began Watching NULL pointer - why i didnt get any errors ?

    Hi All, I got this code from a forum & tried it on g++/Linux. In the code below i put NULL to a pointer variable but didnt get any errors. …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in NULL pointer - why i didnt get any errors ?

    Does it work? It prints "Inside A!!!" but does it print a number on the next line? If not then your program silently crashed. It can get into A::func and …
  • Member Avatar for Banfa
    Banfa

    Began Watching warning: cast from pointer to integer of different size

    Can someone please explain this error and how to fix it? This worked perfectly on my computer but it stopped working when I transferred it to another computer. int hash …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in warning: cast from pointer to integer of different size

    It is not at all clear what you are trying to achieve, however strings is an array of pointer to char (char \*) so `strings[i]` (or any other index) has …
  • Member Avatar for Banfa
    Banfa

    Began Watching conversion of miles/gallon to liters/kilometre

    Please can somebody help me with the line of codes of this question:write a C++ program which inputs litre consumption given in miles/gallon and which translates these figures into the …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in conversion of miles/gallon to liters/kilometre

    Normally it's liters/100 kilometers but ignoring that detail. If you have C in miles/gallon then you need to do 3 convertions miles -> kilometers = times by 1.609 gallon -> …
  • Member Avatar for Banfa
    Banfa

    Began Watching strcmp of array of strings and string

    Can someone please tell me what is wrong with strcmp? I don't understand why I am getting a segmentation fault when comparing array of strings and string. char *strings[100]; char …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in strcmp of array of strings and string

    Line 1: strings is not an array of strings it is an array of pointer to char which means... Line 7: All the entries in strings are pointed to the …
  • Member Avatar for Banfa
    Banfa

    Began Watching Please help with DLL - 2 problems

    Hello, I'm trying to approach .dll's. Tried some tutorials and got into 2 problems: 1. Using rundll32 from the command line is not working as expected. I write in cmd: …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Please help with DLL - 2 problems

    When using rundll32. Read the description of this function, if you pass extra parameters on the command line of rundll32 then it passes a pointer to the parameters to the …
  • Member Avatar for Banfa
    Banfa

    Began Watching Strange Invalid Null Pointer Debug Assertion

    I am in the final stages of testing a text-based game I have been working on for several years but I am running into some major problems with my database …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Strange Invalid Null Pointer Debug Assertion

    This pNResults.push_back(planetName()); for (i2 = 0; i2 <= cols; i2++) { switch(i2) { case 1: pNResults.at(i).pName = string((char*)sqlite3_column_text(statement,i2)); break; default: break; } } can be written more efficiently as planetName …
  • Member Avatar for Banfa
    Banfa

    Began Watching Reversing an answer

    I'm new to C and I'm trying to convert decimal to binary. The result is giving me an inverse number of what's required. I tried to apply modulo on the …
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in Reversing an answer

    You can do the whole thing as a recursive function without a while loop. The sudo code would look something like PrintBinary(Number) { IF Number is 0 Return // End …
  • Member Avatar for Banfa
    Banfa

    Began Watching i/o stream

    is anyone having an idea on how you going to use ifstream & ofstream without using the header of it.
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in i/o stream

    You aren't going to use ifstream or ofstream without including the relevant header. That is what the header is for, to allow you to use the class/declarations.
  • Member Avatar for Banfa
    Banfa

    Replied To a Post in pibonacci series

    That is one way although there is also a formula for the nth Fibonacci number Where Phi = the golden ratio = 1.61803398874989484820458683436563811772030917980576 Fib(n) = (pow(Phi, n) - pow(-Phi, -n)) …

The End.