2,827 Posted Topics
Re: [code=cplusplus] for(i=0;i<=4;i++) { cout << "Please enter a player's name:" << endl; cin.getline(player[players].name,30); if(player[0].name == "end") { cout << "Please enter at least one batter's name." << endl; cin.getline(player[players].name,30); } else if(player[players].name == quit && i != 0) { break; } cout << "Please enter this player's average:" << endl; … | |
Re: [QUOTE=xfngrn13;942453]ahm sorry i wasn't able to post the whole code i was just trying to get the logic of the occurrences anyway ill post my whole code[/QUOTE] I don't know what you did when you posted, but it doesn't seem like you used code tags and I can't get your … | |
Re: [QUOTE=iceskater2752;941507]Numbers whose sum of digits is divisible by 3 represent numbers divisible by 3. Write a program to verify this famous statement. Input a 5-digit integer n from the keyboard. Find the sum of the digits. Call it sum. Verify that either (a) both n and sum are divisible by … | |
Re: Class Intersect - You have no constructor written. You have no non-static class variables. You have a non-static method called [ICODE]getIndex[/ICODE] that refers to only static variables. You have this line: [code] Intersection inter= new Intersection(); [/code] which creates a new instance of a class that has no non-static variables … | |
Re: [QUOTE=sdmahapatra;940273][CODE]ike this : 3,13,23,33,43,53,63,73,83,93 ?[/CODE] yes like this.[/QUOTE] 30, 31, 32, 34, 35, ...? | |
Re: [QUOTE=sophie_kiu;938573]question 1 : I know that c++ could write/ read excel file by changing it into csv format. however, if the content of a cell has a "," inside, then we may have problem when we are reading it as the content may be split into two parts. So how … | |
![]() | Re: [QUOTE=nuar046;939243]what i'm already know is just :know to use the control sequence of dev c++ :know to use the system csl of dev c++ know to choose the libarary of dev c+ that all.[/QUOTE] I don't know what any of these three things are and which is specific to Dev … ![]() |
Re: [QUOTE=amu25;935587]hello! m new to java.i want to create an application that accepts length x width from combo box.there are 100 values.i want to draw a rectangle whose size will change for each value in a combo box depending on its length and width. which method should i use? can any … | |
Re: You've posted no new code. You have no inheritance in the program and presumably still don't, so presumably you don't understand it yet. You can't do it without it. Your last several posts give no clue about what the problem is, so the only advice one can give is "find … | |
Re: [QUOTE=Leniel;937250]The problem ask to enter numb of students up to 100. but the user enter let's say 10. how do i manage to do that in arrays. Sorry if is a bother but i'm a newbie lol.[/QUOTE] Two options. Declare an array statically with 100 elements (max elements) or ask … | |
Re: I don't think you are going to find anything pre-written like that with getline or anything else. You want something that both reads in input AND searches for a string at the same time. I don't know of anything like that that exists, and I don't see anything like that … | |
Re: > I am new to c++ and i advice for this particular assignment. I new to programming. > > The instruction is to use while loop for the two output process and for loop for the other 2 output. Start with code tags and good formatting, as mentioned in your … | |
Re: Code tags. Use them. > > Well for assignment 1, I have done the following. The problem is about displaying the output. It's some sort of messy, have no idea on how sorting it anymore. #include <iostream.h> main() { int cabin[5][5]={{200,210,225,300,235}, {250,465,343,255,344}, {233,333,453,268,365}, {200,325,400,333,222}, {200,160,642,674,358}}; char choose; int total[5][5]; int … | |
Re: [QUOTE=jake43;936674]I have an issue with this assignment, the instructor says that I use the brackets incorrectly that is why the program will not compile. Please provide feedback to correct program.[/quote] Rule 1 when debugging brackets issues. Use code tags. All spacing is stripped out otherwise. Rule 2 when debugging brackets … | |
Re: First thing I noticed is that there is no README file. I downloaded the rar, decompressed it, and I see a bunch of java files and some directories. Presumably I'm supposed to type javac *.java from the command line and there is some main file I am supposed to run. … | |
Re: 1988 Presidential debate on SNL. Phil Hartman as Jack Kemp on how to balance the budget by giving 110%. [url]http://snltranscripts.jt.org/87/87kdebate.phtml[/url] [quote] Pat Schroeder: Please, gentlemen.. we'll get back to you later, let's turn to Jack Kemp. Jack, as much as anyone, you have been identified with supply-side economics. But have … | |
Re: My guess is that you are supposed to pass the string as an argument to the function or display the prompt outside of the function. Regardless, defining the two prompts inside the function seems wrong: [code] int validInput ( string prompt) { cout << prompt << endl; // get user … | |
Re: [QUOTE=mandofl;934620] Also like how do you make a program return two pieces of data from the same player his name and number. I was thinking of trying to use the get highest, but how do u make it return not the points but the other info about the soccer player.[/QUOTE] … | |
Re: [QUOTE=4101;935129]Creating Superclass and subclass. Both class should have 4 methods and the subclass should have additional properties/fields and a constructor. The subclass should have at least one method that overrides a method in the superclass. On another file is creating a manipulator where you use the subclass and all of … | |
Re: [QUOTE=sravan953;935179]Here, try this: [CODE]import java.io.*; class even_or_odd { static void check()throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please enter a number to check if it is even or odd: "); int x=Integer.parseInt(br.readLine()); if(x==0) System.out.println(x+" is even."); else if(x%2==0) System.out.println(x+" is even."); else if(x%2!=0) System.out.println(x+" is odd."); } } [/CODE] Modify … | |
Re: What line gives the error? Highlight it in red or point it out some other way. Also, please give us something we can compile and run. In other words, the class that contains the Bubble Sort function, a main function, something that creates the JList and studentClass objects, stuff like … | |
Re: [QUOTE=NicAx64;932298] too sad I don't know it's the problem of the technology or problem of the school punishing system or school teachers. However is life is valuable more than technology ? [/QUOTE] The issue has nothing to do with technology. The trigger for both of these suicides was that the … | |
Re: [QUOTE=niek_e;935207]C++ is a language that you can use to write programs.[/QUOTE] That's the basics all right, but it was apparently enough to solve the OP's problem, so +rep all the way. You've earned it on this thread. Good job! :cool: | |
Re: [url]http://java.sun.com/javase/6/docs/api/java/lang/Character.html[/url] [url]http://java.sun.com/javase/6/docs/api/java/lang/String.html[/url] The above are links to the documentation for the String and Character classes. Like many things in Java, there are many ways to do something. Scroll down the list of functions in these classes and you'll find functions that: [LIST] [*]Split strings into several different strings using delimiters. … | |
Re: Yes, definitely read the stickies regarding code tags and the rest of the rules. I explained code tags on two of your previous threads. Here, for the final time, is how to use them. [noparse] [code=JAVA] // Paste code here. Adds line numbers, preserves spacing, adds syntax highlighting. [/code] or … | |
Re: Code tags: [code=JAVA] paste code here [/code] 36,000 separate Random objects? public static void rollDice(){ Random rand = new Random(); die1[rollnumber] = rand.nextInt(6)+1; die2[rollnumber] = rand.nextInt(6)+1; } | |
Re: [QUOTE=loozax;934483]can some1 give me an example of sorting and merging an 10 inputted integers?!using java array..[/QUOTE] Google it. "merge sort java code" would be a good search term. Here's a link to an earlier thread of yours where I commented and provided some links. Read them. Same applies here. You … | |
Re: When you mix tabs and spaces, the indentation often ends up looking terrible when you post. A tab is 8 spaces here. I always covert to spaces before posting. [code] //----------------------here i assumed the end of the sorting was and i could return sorted data to JList [/code] This is … | |
Re: [QUOTE=IQLion;933788]Can you tell me please what method should I use and how.[/QUOTE] Even if you fix the switch statement, executable code like switch statements need to be located inside of a function/method/constructor of some type. Your switch statement is just floating around inside your class, so even if you fix … | |
Re: I'm fairly rusty/ignorant on Map and how it works behind the scenes when you use "put" and "get". If you were comparing two strings manually and iterating through some Collection, I'd suggest you use this function (compareToIgnoreCase): [url]http://java.sun.com/javase/6/docs/api/java/lang/String.html#compareToIgnoreCase(java.lang.String[/url]) on each member of the Collection. However, there's also an easy solution … | |
Re: Code tags. Please use them. What errors do you get? I see some obvious ones regarding the variable names. public void setPrice( double price ) { price = ( price < 0.0 ) ? 0.0 : price; } public double getPrice() { return price; } public String toString() { return … | |
Re: [quote] I created a program to read in the file and one that will sort from a string array. [/quote] I assume you mean "function", not "program" here. Please post the functions, or at least the sort function. My guess is that you need to write your own [ICODE]compare[/ICODE] function … | |
Re: [QUOTE=DaBunBun;932457]Are you saying to use a different variable type? Or are you saying to type cast it? If its the first, I want to get the length of a pointer thats being passed. Edit: Forgot to say, thanks for the help. Normally I'd use a vector like that, except in … | |
Re: [QUOTE=Anon17;932371]Hi. I have a function which checks for a placement of a substring in a buffer after recieving it over TPC. It checks for the value up until a '&' appears in the string (As the value can be any length). However, my program crashes if the packet has no … | |
Re: [QUOTE=hell04;930654]Q: Write a program that will determine if a number is even. The program should ask for a number, say X and printout whether "X is even" or " X is not even". This program must use a method with the signature "public static boolean isEven(int i)".[/QUOTE] OK, I wrote … | |
Re: Post with line numbers so we know what lines 95 and 112 are: [noparse] [code=cplusplus] // code here [/code] [/noparse] [code=cplusplus] #include <iostream> #include <iomanip> #include <string> using namespace std; const int nScores = 6; // function to sort scores int compare(const void*pa, const void* pb) { const int& a … | |
Re: [QUOTE=deepak1234u;608464]Pls some one help me for making a java project on the topic "inventory management system"[/QUOTE] Start a new thread. This one was useless enough four years ago. Let it die and never rise again. Start a new thread, but before you do, read the rules about showing effort before … | |
Re: [QUOTE=jessejamesjjr;930683]can any one help me find info on modular programming and how to understand it's functions? any links to go to?[TEX][/TEX][/QUOTE] Try googling "modular programming". | |
Re: [QUOTE=majestic0110;931487]Hi all, I hope you are well. I am trying to explain some code to a friend : [CODE]StringConcatenate StringConcatenate1 = new StringConcatenate(); StringConcatenate1.stringConcat(); [/CODE] I said that this code creates an object "StringConcatenate1 " of type StringConcatenate and executes method stringConcat() (which is from class StringConcatenate()) on object StringConcatenate1. … | |
Re: Code tags. makes it easier to read: [noparse] [code=cplusplus] // paste code here [/code] or [code] // paste code here [/code] [/noparse] Why do you have two separate while conditions here and where is each supposed to start and end? Stick some brackets in there to make it more obvious. … | |
Re: [QUOTE=_dragonwolf_;931428]Ok, here is what I have for my compareDates() function in my class: [CODE] int Date::compareDates(int m, int d, int y) { if((month < m) || (day < d) || (year < y)) cout << "This date comes before previous valid date." << endl; else if((month == m) || (day … | |
Re: [QUOTE=_dragonwolf_;929878][COLOR="Red"]It will read the number values of the months and convert it to the string value[/COLOR]. However, I also need it to read in the string value of the month and display the string value of the month. The program will read until it reaches a string value and then … | |
Re: Java-specific BB Code. [code=JAVA] paste code here [/code] Non-Java-specific BB Code. [code] paste code here [/code] class FindString { public static void main(String arg[]) { Scanner ob=new Scanner(System.in); String st="I am a student, you're also a ."; String search; String st2=""; String st3=""; int i,c=0; System.out.println(st); System.out.println("Enter your word to … ![]() | |
Re: [QUOTE=Asafe;930441]No, to [I]test[/I] use isupper() or islower() .[/QUOTE] Depends on what you're testing. In this case, to test whether a character is 'b' or 'B', use toupper or tolower: [code] char someChar = 'b'; if (toupper (someChar) == 'B') { cout << "It is either a 'b' or a 'B'."; … | |
Re: [QUOTE=gangsta gama;927720]Hello all, I have been programing for a year or two and i dont get vectors. I have seen them with numbers but can someone give me an example of vector.erase with letters? like for an RPG: like sword, axe, armor. Then have them chose what they want to … | |
Re: > I was Writing a code to connect data base and add the following code to my action.java Connection connection=getConnection("UserBook","UserBook123","catalog","localhost"); String sql="select BookName from book"; PreparedStatement ps=null; ps=connection.PreparedStatement(sql); ResultSet set=ps.executeQuery(); while(set!=null&&set.next()) { System.out.println(set.getString("BookName")); } connection.close(); > the error i get is "The method PreparedStatement(String) is undefined for the type Connection" … | |
Re: I explained here that you need to to post the pattern in code tags or else all the spacing gets stripped out, as well as how to do it. [url]http://www.daniweb.com/forums/thread206645.html[/url] You also need to post your code in code tags. [noparse] [code=JAVA] // paste code here [/code] [/noparse] | |
Re: [QUOTE=anumitadas;929150]Plz Help me to print in [B]java [/B] a b a b c b a b c d c b a b c d c b a b c b a b a[/QUOTE] All spacing gets stripped out when you don't use code tags! [noparse] [code] // paste pattern here … | |
Re: [QUOTE=axeeffect2002;929512]@moderator Please delete the post #7, where I've given the java code. Thanks.[/QUOTE] axeeffect2002, don't worry about it. We know you are trying to help. Just try to keep peter_budo's post in mind in the future. Everyone has a different style and gives advice differently. It's fine to give code, … | |
Re: Code tags. Read Salem's links regarding how. What exactly do you want? Add some cout statements for "delete" and "edit" to the menu above. No one is going to go through your first post without line numbered C++ code tags. [code=cplusplus] paste code here [/code] You need to ask a … |
The End.