•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 397,598 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,853 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 3912 | Replies: 10
![]() |
•
•
Join Date: Sep 2004
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
How can I write a program that will read as input two strings and display the word true if the strings are the same and false otherwise. In this activity, two strings are the same if they contain exactly the same characters in the same order (i.e. 'A' and 'a' are not the same characters).
Please help!!! And type give me the code for that !
thank you!!
Please help!!! And type give me the code for that !
thank you!!
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 10,880
Reputation:
Rep Power: 32
Solved Threads: 108
dncloud, we do not support the direct answering of homework questions on these forums without you putting in some effort yourself.
So let's break the problem down.
- Prompt user to enter string one
- Get string one from keyboard
- Prompt user to enter string two
- Get string two from keyboard
- Use Jason's algorithm above to compare if the two strings are equal
- Display the result
Do you know how to do each of those things individually? If so, you can put them all together to build your program.
So let's break the problem down.
- Prompt user to enter string one
- Get string one from keyboard
- Prompt user to enter string two
- Get string two from keyboard
- Use Jason's algorithm above to compare if the two strings are equal
- Display the result
Do you know how to do each of those things individually? If so, you can put them all together to build your program.
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: Dec 2003
Location: Nashville, TN
Posts: 2,333
Reputation:
Rep Power: 11
Solved Threads: 101
I slightly modified your post's topic to make it more polite. "Emergency! PLease help!!!" implied that you deserve precedence over someone else's post, which is kind of considered poor etiquette, and could be considered rude, frankly. Additionally, your thread title has no relevance to your actual question. Creating a relevant thread title also helps you attract people who could help with your problem.
Just letting you know for future reference.
Just letting you know for future reference.
Alex Cavnar, aka alc6379
•
•
Join Date: Aug 2004
Location: North Carolina
Posts: 25
Reputation:
Rep Power: 5
Solved Threads: 0
Hi dncloud, nanosani has put you on track pretty good. You use equals to compare strings. If you do not care whether or not the case of the two strings are identical you can use the equalsIgnoreCase() method.
•
•
Join Date: Nov 2004
Location: Syudad sa SUGBU
Posts: 11
Reputation:
Rep Power: 4
Solved Threads: 0
uhmmm, guy, how could I declare variables for string in TURBO C? isn't it:
#include<stdio.h>
#include<string.h> /* is this right??? */
int z=0;
char x;
main()
{
printf("blah blah blah");
scanf("%s",&x);
z=strlen(x); /*can I use this??? cause in my pc, it says that posible use of 'x'...
I would like to count the number of character the user inputs...*/
printf("it's %d",z);
getch();
}
•
•
Join Date: Dec 2003
Location: Nashville, TN
Posts: 2,333
Reputation:
Rep Power: 11
Solved Threads: 101
•
•
•
•
Originally Posted by Archer
uhmmm, guy, how could I declare variables for string in TURBO C? isn't it:
#include<stdio.h> #include<string.h> /* is this right??? */ int z=0; char x; main() { printf("blah blah blah"); scanf("%s",&x); z=strlen(x); /*can I use this??? cause in my pc, it says that posible use of 'x'... I would like to count the number of character the user inputs...*/ printf("it's %d",z); getch(); }
Just as a passing aside, this is the Java forum...
Alex Cavnar, aka alc6379
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Java Marketplace
- Compare strings (C++)
- compare two strings or compare two files? (Visual Basic 4 / 5 / 6)
- How to compare two strings? (C)
- comparing strings (C++)
- Comparing Strings in C# (C#)
- Compare strings... (C++)
Other Threads in the Java Forum
- Previous Thread: How do i verify a string using hashtables
- Next Thread: Java editor



Linear Mode