TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
328.2k
Convert array string into integer
Feb 22 2012 11:09 AM
This program has to finds whether a book dealer carries a requested book. When using BinarySearch() method both argument inside the parenthesis should be in integer.
How to convert string array ("books") into integer array.
using System;
public class DebugSix04
{
public static void Main()
{
String[] books = { "Rich Dad", "Poor Dad", "Catch-22", "Harry Potter", "Programming Using C#", "Wizard of Oz", "The Deep" };
Console.Write("What book are you looking for? ");
int enterBookName = Convert.ToInt32(Console.ReadLine());
int x = Array.BinarySearch(books, enterBookName);
if (x > 0)
Console.WriteLine("{0} not found", enterBookName);
else
Console.WriteLine("Yes, we carry {0}", enterBookName);
}
}
Reply
Answers (
8
)
what is serialization and reflection
XML format not filling data table correct