15,300 Posted Topics
Re: [QUOTE=Muhammadlodhi;1189552]i need a solution if anyone have plz[/QUOTE] Then write one yourself. Take the hints already given and start coding. Nobody here is going to write your program for you. | |
Re: If you look at any standard ascii chart you will see that every character on the keyboard has a decimal value. The digits '0' through '9' have a decimal value of 48 to 57. To convert any digit to an integer all you have to do is subtract '0' (or … | |
Re: [code] #include "vehicle.h" #include "vehicle_imp.h" [/code] One or both those header files define the vehicle class. | |
Re: You will be much better off using just winsock API functions. People tell me MFC CAsyncSocke and CSocket sucks canel water. | |
Re: if(((int)str[count]>=65 && (int)str[count]<=90) || ((int)str[count]>=97 && (int)str[count]<=122)) it would make more sense like this so that you don't have to think about what the decimal values for 'A' and 'a' are. You are trying to find out if the character is A-Z or a-z, not 65-90. if( (str[count]>='A' && str[count]<='Z') … | |
Re: The loop in the read function is incorrect. Using eof() like that will cause the last line to be read twice. Here is the standard way to code that loop [code] while( myfile >> a[i] ) ++i; [/code] >>The crazy thing is, when i give static size to the arrays, … | |
Re: The error message says it all -- the Node class has a destructor but the implementation for it was never coded. | |
Re: It is not necessary to use an array. There is no requirement to display the results in columns. I would save the grades in a text file then when done entering the grades read the data file and display the results. | |
Re: >>#include <conio> There is no such file. You probably mean conio.h And what are all those notes?? | |
How are we supposed to search for something in code snippets? I tried Site Search, selected C++ Snippets but got results in all the forums EXCEPT code snippets :icon_eek: That makes the Site Search almost unusable when searching for key words in specific forums. And using DaniWeb Code Snippets link … | |
Re: Post the program you have tried to write. Hint: use three integers for keyboard input -- one for hour, another for minutes, and the third for seconds. | |
Re: Yes of course it can. Most, if not all, c++ compilers can compile C code. Just name the file with *.c extension instead of *.cpp and the compiler will treat it as C. | |
Re: >>The truth of the matter was that they returned to school as they didn't want to enter the jobs market. Maybe they should be taught a job marketable skill instead of college prep skills. Instead of chemistry teach them auto repair, iron working, welding, woodworking etc. They might get more … ![]() | |
Re: Use your compiler's debugger and step through the program one line at a time. | |
Re: All MS-Windows computers have IE -- at least in USA. I've heard there have been some lawsuits about that around the world but I don't know the outcome. [icode] HINSTANCE hInstance = ShellExecute(NULL, "open", "www.google.com", NULL, NULL, SW_SHOW);[/icode] The above will use the default browser, whatever that is. | |
Re: The questions depend on the platform. [URL="http://en.wikipedia.org/wiki/Calling_convention"]Here is a wiki article[/URL] The return value on Intel based computers is normally stored in the eax register then after the function returns the value is copied to some variable. | |
Re: [QUOTE=WaltP;1146322]What amazes me is each and every company can save you hundreds by switching from one of the others. That basically means you sign up and the insurance company gives you a $300 check! Then you can switch again and get $700 from the new one. It's a really useful … | |
Re: AFAIK you can not delete attachments. I have wanted to do the same thing but was told that I can't. | |
Re: You could do it something like this, which increments the pointer by 2 on every loop iteration. [code] int main() { int array[10][2] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}; int* p = (int *)&array[0][1]; for(int i = 0; i < 10; i++) { std::cout << *p << '\n'; p += 2; } return 0; … | |
Re: move line 26 down outside the loop to line 30. Its not necessary to calculate the average every time a number of read. Do it just once, after all numbers have been read, summed and counted. Your program may do nothing at all if the file can not be opened. … | |
Re: Don't you mean you need to use std::string's find() method? e.g. [code] std::string word = "Hello"; size_t pos = word.find('.', 0); [/code] In the above, just put it in a loop and replace the second parameter to find() with the variable pos that was returned by the previous find. Keep … | |
Re: [quote]we've (the students) have already worked on compiler and interpreter design prior to this, which I haven't yet. So with that knowledge there is a chance I may need to drop the class because of this[/quote] I'm surprised your university even let you register for that class without the prerequisits. | |
Re: google for sort algorithms, there are several of them but the one you posted is not one of them. The easiest to code is the bubble sort. | |
Re: >>I'm also sure I read somewhere that you can't pass a class as a function argument. You must have misread it. The class in a is a new instance of the class while the class in b is the same instance. In a the class is passes by value, meaning … | |
Re: Look carefully -- the function prototype says the first parameter is [b]const[/b] but the actual function does not. They have to be the same. | |
Re: declare two variables a and b then subtract their addresses. That is really a terrible way to do it because there is no guarentee that the two variables will be next to each other -- the compiler is free to put anything it wants between those variables. Using the sizeof … | |
Re: >>How to fix the problem, please? what problem?? CopyFile() parameters are [b]const char*[/b], not std::string. Call string's c_str() method to make the conversion. | |
Re: You don't need a 64-bit compiler for 64-bit operating systems (unless of course you want the compiler to generate 64-bit code). 32-bit compilers work great. I have 64-bit Windows 7 and use vc++ 2008 Express and Code::Blocks with MinGW. Both both without a problem. | |
Re: Nice work :) Its just as unsafe as the original. | |
Re: See post #7 on [URL="http://forum.codecall.net/c-tutorials/9095-clear-screen-windows-console-using-api.html"]this thread[/URL] | |
Re: have no idea because it isn't c or c++. | |
Re: If you are going to use std::string then you have to learn to read all about what that class can do instead of being spoon-fed on some forum. google for std::string and you will find a list that tells you how to use it. | |
Re: what you want in C is FILE structure and associated functions found in stdio.h | |
Re: You need to use { and } between the if and else statements [code] if( something ) { // code here } else { // more code here } [/code] | |
Re: It would have been a lot better to have posted the actual code in code tags to preserve the program's format, such as tabs and spaces. I won't bother reading code that isn't at least formatted a little bit. | |
Re: Look at the first error, fix that and several others will probably disappear the next time you compile it. For example vc++ 2008 express complained about line 18. Well, the actual problem is on the line above it -- line 16. Look carefully and you will see that it is … | |
Re: [url]http://forum.codecall.net/c-c/27272-c-gets-function-implementation-help.html[/url] | |
Re: dev-c++ is dead and buried. You can't even download it any more, and the web site has been taken down. Ditch it and get Code::Blocks with MinGW. AFAIK it won't do Windows Forms either. | |
Re: variable [b]b[/b] is declared twice. Remove the declaration on line 11. And it should be size_t, not int | |
Re: [code] int i; while ( i <= pow2 ) { result *= pow1; i++; } [/code] In the above code, what is the initial value of variable [b]i[/b]? | |
Re: call win32 api function CreateProcess() and you will have a lot more control over how the new process is created. Never tried it with a *.py program. | |
Re: [QUOTE=mabpest;1181107]What are the primary differences between wireless voice and paging systems.[/QUOTE] One has wires and the other doesn't ? | |
Re: [QUOTE=gerard4143;1183804]If the compiler will generate the proper machine codes and the linker will produce the proper addresses then yes it will produce executable code....The only remaining obstacle is wrapping the executable code in a format recognized by the operating system...[/QUOTE] Isn't that the job of the linker? The program doesn't … | |
Re: [QUOTE=chrishea;1106004] Trying to go to Vista from Win 7 makes no sense.[/QUOTE] I think you have that reversed, but I agree that going from Win7 to Vista is a bad idea. People get what they pay for -- installing pirated software will get you a lot more than what you … | |
Re: [QUOTE=cwarn23;1175757]Yes and this thread is 12 days old and still Dani has taken no action. How long do we need to wait before such a feature will be introduced?[/QUOTE] She already has taken action. This topic has been discusses several times over the last 5 years that I have been … | |
Re: >>if ( bad = true ) You need to use the boolean operator == instead of the assignment operator =. That is a common error made by people coming from other languages such as VB which use = to be either assignment of boolean. | |
Re: you have to make the program pause before it exits back to the operating system. [code] #include <stdio.h> int main() { system("pause"); return 0; } [/code] | |
Re: 32-bit vc++ 2008 express on 64-bit Win7 doesn't have that problem. [code] #include <iostream> #include <limits> #include <string> #include <iomanip> using namespace std; int main() { // use textual representation for bool cout << boolalpha; // print maximum of floating-point types cout << "max(float): " << numeric_limits<float>::max() << endl; cout … | |
Re: Homework? You answer the questions and we will tell you whether you are right or wrong. | |
Re: are you trying to print all the odd numbers between two values? Your program is doing much too much work! It only needs one loop, not two. Delete that second loop and just test if the loop counter d is even or odd. |
The End.