i think because updates are over you can use a key for xp(but not a crack)
Microsoft wont be worrying about xp piracy anymore.Anyway its not legal!!!
You're an idot if you believe that.
i think because updates are over you can use a key for xp(but not a crack)
Microsoft wont be worrying about xp piracy anymore.Anyway its not legal!!!
You're an idot if you believe that.
Check spelling and capitalization of balancedparentheses. Is that function prototyped in one of the include files?
emails are blocked until you have been a member for a certain period of time and made several posts. I don't know how much time or the number of posts, but it's more than what you have now. Begin actively helping others in other forums and you will eventually be granted the ability to sent PMs to other members.
you could change it to *.cpp and eliminate the warning.
You don't know how to fix what exactly?
ut why the double don't accept integers?
It has to do with what the compiler pushes on the stack. Integers are 4 bytes on the stack while doubls are 8 bytes. You told va_arg that the parameters are doubles and va_args attempt to get 8 bytes off the stack.
arning: command line option '-std=c++11' is valid for C++/ObjC++ but not for C
Does that file have *.c extension or *.cpp extension.
How were you able to post this thread if you are not registered?
I tried formatting my Windows from beginning.
You mean you really reformatted your hard drive? Why?
Tried registering to 10 different forums and same problem.
You mean you get the same problem on all 10 forums? Maybe it's your name, try a different name.
line 54 is sending 3 integers, not 3 doubles. Make them doubles and see if that solves the problem.
double a=average(3,10.0,50.0,6.0);
In that case calloc() is unnecessary. If all you want to do is make a copy of another string then just do this:
strings[hash] = strdup(mneumonic);
post how you are calling that function.
line 10: No, you can't concantinate C strings like that
char fname[255];
char *ptr;
strcpy(fname,argv[1]);
ptr = strchr(fname,'.'); // truncate extension
if( strcmp(ptr,".txt") == 0)
{
printf("Error: can't write to the same file as input file\n");
}
if( ptr != NULL)
*ptr = '\0';
strcat(fname,".txt");
Data3 = fopen(fname,"w");
MessageBox() does NOT return a double. Look it up.
When you get that kind of error just look up the function and see what arguments it expects. Simple use google to do that. In the case of _vscprintf() you are passing the wrong arguments. (link)
We don't do homework for you. Post the code you have written and we'll talk about it.
This discussion reminds me of the Geritol fiasco a few years ago (1960s). I remember those Geritol commercials -- it was the cure for almost everything.
student enter his name in digits no dought it is wrong
Not necessarily -- depends on where you live. In some places it might be perfectly legal to name a baby R2D2.
AD - you're being too M$-centric.
LOL You're right :)
One reason -- With C/C++ you can directly access hardware.
the _vsntprintf() link isn't working
You're right -- I must have copied the wrong url into the clipboard.
but why use it? what means?
I don't use it. there may be a compiler setting to change the default to something else, but I'm not sure about that. That's the only reason I can think of to use CDECL.
_cdecl is the default calling convention for Micosoft Visual Studio. There is no need to explicitly use CDECL.
_vsntprintf() -- wrong. (link). How is _vsntprintf() supposed to know the size of the first parameter???
Please study a tutorial on variable arguments, then you will understand how that function is working. vsntprintf () is doing all the hard work of combining all the strings in the last parameters to that function.
It is possible to use any number of characters '/' as a delimiter in path instead of one traditional '/'. FIt is possible to use any
No. When in doubt test it in a command prompt. MS-Windows accepts only a single / character immediately before each folder name.
If the assignment is to concantinate 3 or more strings at the same time then lines 45 and 46 do not test that problem. So if this is a class assignment then your instructor might (or might not) mark you down for that. z = x + y + l
is the correct way to test the assignment.
because on line 35 you are passing s and s has not been initialized. I would change input() to accept the parameter by reference and not by value.
Why are you using gets()??? you should be using cin.getline()
void input(book& details)
{
cout << "Book Title : ";
cin.getline(details.title, sizeof(details.title));
cout << "\nBook Author : ";
cin.getline(details.author, sizeof(details.author));
cout << "\nBook : Price : ";
cin >> details.price;
}
then line 35 becomes
input(s);
Another way to do it is for input() to have no parameters at all.
book input(void)
{
book details;
cout << "Book Title : ";
cin.getline(details.title, sizeof(details.title));
cout << "\nBook Author : ";
cin.getline(details.author, sizeof(details.author));
cout << "\nBook : Price : ";
cin >> details.price;
return details;
}
line 84: flush the input stream here. You don't need cin.ignore() in the other places where you have it.
Also, study this thread how to flush the input stream. Just using cin.ignore() may not do it.
#include <limits>
...
cin.ignore(std::numeric_limits<std::streamsize>::max(), cin.widen('\n'));
Change lines 45 and 46 back to the way you had it. There was no need to change that line.
z=x+(y+l);
Here is what I see when I run your program
Enter string = one
string is = one
Enter string = two
string is = two
Enter string = three
string is = onetwothree
There is no theoritical limit to the number of strings you can concantinate with that. for example
Enter string = one
Enter string = two
Enter string = three
Enter string = four
Enter string = five
string is = onetwo threefourfive
All I did to get the avove was add a couple more instances of your count class, removed all those blank lines, then change line 44 to this:z = x + y + l + m + n;
using namespace std;
is actually bad practice because it floods the program with everything in std namespace, and sometimes that causes name clashes with your own code. I cam across that very situation in another thread here at DaniWeb just today. Even Bjarne Stroustrup, the author of c++ language, adises against using namespace std;
statement.
Which to use will depend on your compiler. Old Turbo C++ will use iostream.h but all recent compilers use <iostream> (without the .h extension)
You also need a using statement.
#include <iostream>
using std::cout;
using std::cin;
Did you bother to try what I told you? You're english is good enough and you express yourself very well. This is the code I'm trying to tell you about.
count()
{
str[0]='\0';
}
count operator +(count x)
{
count t;
strcpy(t.str,str);
strcat(t.str,x.str);
return t;
}
solution is simple: just remove the second parameter to that operatopr function and delete line 23.
Forgot to say that you can use real numbers in matix.
That's ok -- you can't put irrational numbers in an int anyway.
Finding the largest array of positive numbers should be fairly straight forward. Just cound the number of positive numbers until either the end of the row is hit or a negative number is found. You will probably need to use two other arrays to do that.
that error means you failed to implement that function in your *.cpp or *.h file. Also recheck spelling and capitalization to make sure they are consistent.
line 18: operator can only have 1 parameter.
line 3: uncluding all std like that causes a name conflict with your count class name. replace that line with using std::cout;
or change the name of your class to something else.
After fixing those problems your program works ok for me.
Your program appears to be retaining one of the last answers
1 10
1 10 20
100 200
100 200 125
201 210
201 210 125
900 1000
900 1000 174
The problem is that you need to reset maxCaseLen back to 1 after the scanf(), between lines 12 and 13.
your answer for 201 210 is 174, should be 89 according to the example input/output in the instructions.
wonder why UVA doesn't accept my answer
How are we supposed to know that? You didn't even tell us what that program is supposed to do. And what is UVA? My guess University of Virginia???
You can do that with both functions.
The entire class is quite dangerous -- how can you be sure the results of line 43 will not overflow the size of str (line 7)?
line 20: What is the contents of str at that point? Hint: undetermined because you failed to initialize str in the constructor. Just setting the first byte to 'r' does nothing at all. It need to be set to '\0', which is what all the fucntions in string.h expect.
There is no reason to do all that shifting. Forget shifting, it doesn't do you any good.
its terreble if XP will be shut down
No one said XP is being shut down. It's your computer, run it as long as you want.
So, all you have to do is to read 4 bytes then reverse them. The whole problem of endian-ness disappears if you write out the file as plain text instead of binary.
#include <iostream>
#include <fstream>
#include <vector>
#include <cstdint>
using namespace std;
int main(int argc, char *argv[])
{
if (argc!=2)
{
cout<<"Invalid argument count, please provide a file name."<<endl;
return 0;
}
fstream file(argv[1],ios_base::binary|ios_base::in);
vector<int32_t> data;
int32_t tmp;
char buf[4];
while (!file.eof())
{//complicated i/o to ignore endianness
file.read(&buf[3],1);
file.read(&buf[2],1);
file.read(&buf[1],1);
file.read(&buf[0],1);
temp = *(int32_t*)buf;
data.push_back(temp);
}
for (size_t i=0; i<data.size(); ++i)
cout<<hex<<data[i]<<endl;
return 0;
}
When I do it your way I get everything inverted
I wasn't aware that endian-ness was the problem you want to resolve. My way is only useful if that isn't an issue.
Here's an article that, I think, shows how to determine the endian-ness of an operating system.
Here is a discussion about your problem. Pay attention to the function in the last post. All that's neccessary is to swap the bytes of the integer, not the bits in each byte.
consider the 4 byte hexidecimal number 0xbebafeca. on a big endian machine this would be stored in contigiuos memory as [be][ba][fe][ca], whereas on a little endian machine the format would be [ca][fe][ba][be]. viewed as an array of unsigned char, to reverse the byte order you would need simply to swap the first element of the array with the last and the second with the third.
You can't just remove a row from a statically allocated array, and it's a little tricky to remove a row from a dynamically allocated array.
For statically allocated arrays the best you can do is to copy the contents of all the rows you don't want to remove up to fill in the gap, then the last row in the array is considered unused.
For example: if you have an array of 10 rows, in order to remove row 2 you have to copy rows 3-10 up to rows 2-9 then somehow mark row 10 as unused. The array still has 10 rows, but your program would consider the last row as unavailable.
For dynamic arrays when you want to remove row 2, do it in several steps
Step 1. malloc() a new array the same size as the original but with 1 fewer rows.
Step 2. copy all the rows from the original to the new, omitting the row to be deleted.
Step 3. free() the original array
Step 4. set the pointer of the original array to be that of the new array.
realloc() might work here but only if the row to be deleted is the last row in the array, so it's not useful in your program.
longest subarray of positive numbers in one row
I don't know what you mean by that. Does it mean the array can contain both positive and negative numbers? Post a simple example to …
Or change line 13 to this so that token has a pointer to unique memory:
token[i]=strdup(buff);
but wrong because it happens to be a lie ;)
And how would you know that unless you were there?
you can't shift an 8-bit char by 24 bits (line 20). What are you trying to accompolish? Why do any shifting at all? If you're attempting to read a 4-byte integer, why not just do it the simple way
int num = 0;
file.read((char *)&num,sizeof(int));
i also understand this but how to concatenate two or more string usin operating overloading
Did you study the code in this thread? The OP created a class similar to std::string that concantinates two character arrays (not std::strings).
See the article in the link I posted. The answer: long after you're dead.