thanks for the warning of the memory leak, didn't notice... that's the reason why such code would never be possible to write in an exam, to long and complicated to write.
Type: Posts; User: guest
thanks for the warning of the memory leak, didn't notice... that's the reason why such code would never be possible to write in an exam, to long and complicated to write.
yes i did not took to account the difference of big and small letters, let's say i would it's not complicated, also final result isn't returned and from the question it isn't implied that it should...
thanks , although we didn't learned the functions isalpha and upcase (or any other from ctype.h) i'll try to write it without using them. and see the result
thanks!
hi, i have C exam next week, so i started solving questions from previous years exams and run into this question, the answer i come up to is far far from having reasonable length, it's too...
in your first version declare an int called totalSeats and intialize to zero outside the loop. Inside the loop increment totalSeats by seats each time through the loop. Output totalSeats only after...
instead of
cin.getline(infob, '\n) ;//what is infob?? you never declare it.
it should be
new_name.getline(age, 255, '\n')
or
lets assume that the file is set up like thiS:
12345,ASDFG,FRT,A-,A-,A,B+,A-,F,D-,F,AB-,AB-,AB-,AB-
22222,etc.
Thus it is has the requisite fields and is comma delimited. If that's the way the...
if the value of key is found in the array passed in then the value of key which equals array[i] is returned and the function stops without the second return statement ever being reached. If the...
The functions you need are probably not all that difficult. The problem is figuring out the algorhythm to use first. Forget about writing code to begin. Set things up so you can work start solving...
instances of the string class cannot be null, but they can be empty. in your constructor try this:
bookmarks::bookmarks()
{
int i;
for(i = 0; i < size; i++)
{
url[i] = "";
title[i] = "";
}
I would encourage you to write out in english what it is you are trying to do before you try to write code for the process. Here's and example.
This problem will accept user input of 20...
you can't increment a constant like 4 or 21 or 0.89. therefore
sales *= 4++;
doesn't compute. However
sales *= 4;
expands to
Here's an algorhythm that relates how I would try solving this problem
develop function to check for valid move (so don't overwrite array)
develop function to display pad
develop function to...
from a logic standpoint you have declared total to be of type long, which is an integer value. Then, in the 2 argument constructor you assign the value of cents (defined as type int) divided by 100...
I haven'tcompiled and ran the program, but it should work fine without recursion. Liberty is a fine author in my opinion. Read on!
I hear there is a permutation function in the STL. Alternatively you can write one of your own using a set of nested loops.
You're welcome to try these ideas, some may work, others may not.
1) add line: #include <iostream> in main program.
2) +/-: delete the line #include <iostream> in MailingLabel.h
3) +/-:...
#include<iostream.h>
#include<math.h>
int main()
{
int number=0,
x=0,
power=0,
ans=0;
instead of '\0' how about using -1 or -999 or some other number not expected in the arrray? I would be careful about putting a char into an int array as the compiler may well convert the char to...
strtok returns a char * which is different from a char [] although both can be used to represent a string. The compiler says it can't find a prototype to convert the rhs to the left. I would try...
Compiled my last bit of code. Works as promised. Continue to read replies. Continue to learn. Thanks for expanding my horizon.
You're standing my world on it's head! Not that I haven't had similar experiences before, but still.
In review for my benefit and your critique. Given:
char * ptr;
//the following won't...
I love to learn new things. This may be yet another opportunity.
This I knew was acceptable:
char * ptr1;
char * ptr2;
char ch = 'A';
ptr2 = &ch;
ptr1 = ptr2;
cout << *ptr1;//A is printed...
My concerns include:
At the end of the declaration of a class/struct interface there should be a semicolon, so I think the semicolon issue brought up is in error, not the code as written, on that...
almost right, fOul. It is not possible to assign a string of char like Jacob to a single char like name as bsb77 wrote. You assign a string of char to a char array (which is often called a c_style...