139 Posted Topics
Re: 65 - (61 + 0) = 4 66 - (61 + 2) = 3 67 - (61 + 4) = 2 68 - (61 + 6) = 1 | |
Re: Hi, Put your code in code tags, it helps when reading. The answer is staring you in the face. [code] fullWord = oneWord + ", " + twoWord + ", " + threeWord + ", " + fourWord + ", " + fiveWord; [/code] Change the order of that to … | |
Re: Are you attempting to do this from a command line or running the program and then picking apart the input from there? Running from a command line is easy. Picking a string apart inputed after the program is ran is also easy, but a bit more involved I think. | |
Re: [code] ifstream in; // Create an input file stream. in.open("data.txt"); [/code] that will open data.txt as read only. If you want to protect the file from being written over, I suggest you modify the properties of the file, or (if using windows) go to a command prompt, go to the … | |
Re: You need to include the switch statement in your do while loop otherwise, you will never exit the do while loop. Also, with your switch statement, everything in your default will never run. [code] //None of this code will ever run. If you enter a number to break your do … | |
Re: Going through how to optimize code would take months to explain. Linear code is linear code. Both statements take x amount of time. Avoid many nested loops. If you have code, it would be easier to explain where your coding might be inefficient. Edit: If you just want to know … | |
Re: You have a logical error in your sort. In your main, you leave name[0] unused but in your second for loop, you don't take that into account on your variable num. [code] void sortnames(string name[], int num){ int i,a, min; string strName; for (i = 1; i <= num; i++) … | |
Hi there! My name is Ken, and I'm an old (not age) C++ programmer. I went to school for it, and it's been about 7 years since I've actually programmed anything hard, so I figured a forum would be a great place to relearn alot of it by teaching what … | |
Re: Edited because I was wrong: You can call someFunction by s1.someFunction(s2) and have it return whichever value you want, but you will still need to make it a void function if you want both values returned. It would be easier to make a seperate function to access s1's b vaule. … | |
Re: Create a structure to hold all the information and a linked list to contain the structures of each individual. You may need to create 5 special functions in the class that returns the number of people under 20 (1), 20-29 (2), 30-39 (3), 40-49 (4), 50 and older (5). Step … | |
Re: A few things here .... First, wrap your code in code tags. It makes it easier to read. Secondly, what kind of error are you getting? Thirdly, I noticed that your while loop runs until temp != Null but two lines down from that you try to reference temp->next->word. If … | |
Re: [QUOTE=Fbody;1331701]Your intent is a little confusing, it sounds like you want to add multiple items to the same element of an array. Which is not directly possible. [/QUOTE] Actually, I think if you create a structure, and then create an array of that structure, you can do what the op … | |
Re: If [code] cout << songname << endl; [/code] works as intended and prints the song names on each individual line, then the send function is missing the endl. Is send in a library or a function you created? I'm not familiar with it if it's from a library. | |
Re: The value is returned to the location where the function call came from [code] total(num1,num2); [/code] However, you didn't assign it to a variable. The return statement returns the value sum to the function call. You can do it two ways, either set the returned value to a variable declared … | |
Re: Alt + F3? [url]http://msdn.microsoft.com/en-us/library/0zz35x06(VS.80).aspx[/url] Or maybe Ctrl+K, Ctrl+L? [url]http://www.codeproject.com/KB/tips/VSnetIDETipsAndTricks.aspx[/url] That's all I could find. | |
Re: Can't you just get rid of all the if statements, and use [code] cin >> sp[index - 1].name >> endl; //etc ... [/code] And then the same concept for the viewSpeaker? | |
Re: Ok, I'm a bit out of practice, so if I'm incorrect in my information, it would be helpful if someone corrected me here. It looks like you need to add a new node onto the linked list with the student name, the university, and the id. That is what you … | |
Re: [QUOTE=lilfish08;1304204]I am fairly new to c++ and have been working on this problem and asked the professor for help, but he has really been non-compliant. I am lost on this and keep gettin error messages that I do not understand how to fix. Any help that could be given would … | |
Re: [QUOTE=miskeen;1304154]Guys, I got an error with the following code: [CODE] struct myStruct { int myVar1; }; class A { //definition of A ... }; [/CODE] [CODE] struct myStruct { int myVar1; }; class B { //definition of B ... }; [/CODE] [CODE] struct myStruct { int myVar1; }; class C … |