Sid_TheBeginner

Members
  • Content count

    35
  • Joined

  • Last visited

Community Reputation

157 Neutral

About Sid_TheBeginner

  • Rank
    Member
  1. i need suggestions can you help me?

    This Guy gives the perfect guide to becoming a professional game programmer or a hobbyist. Watch all the 3 parts: [url="http://www.youtube.com/watch?v=zAgpsks29W4"]http://www.youtube.com/watch?v=zAgpsks29W4[/url] --Sid
  2. Looking for a friend / tutor.

    Google Game Institute. You gotta pay them just 99$ for the whole stuff. Some discount going on I guess. They're not frauds. Piratebaybay told me so, it also told me their content is just awesome ;) But you pay them 99$ and you'll get full support for your course. Its perfect for beginners. As its right from the ground up and will take you flying. --Sid
  3. Binary Search Help Repost.

    [quote name='szecs' timestamp='1340957881' post='4953883'] O wow, I didn't see there's no[i] i++[/i] in the [i]for [/i]loop. So indeed, you have an infinite loop. It would have been much easier if you explained what happened in the very first place. I didn't know we have to debug [b]the whole thing[/b]. Please, learn to ask questions and learn to describe the problems in detail. [/quote] Sorry... Actually I didn't know there was a problem there. [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img]
  4. Binary Search Help Repost.

    I replaced for with while that helped. Thank You. @ szecs you're not the only one who didn't notice it [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] . In another forum also, someone has just now figured it. THank you'll --Sid
  5. Binary Search Help Repost.

    I wan't to print "Not found" if a value which isn't found in the array is entered by the user.
  6. Binary Search Help Repost.

    [quote name='Sid_TheBeginner' timestamp='1340951361' post='4953848'] @szecs Hey, thanks for your replyl! Do you mean this: [CODE] #include<iostream> using namespace std; int BinSearch(int data[], int numElements, int searchKey); // Prototype int main() { int data[] = {1, 4, 5, 6, 9, 14, 21, 23, 28, 31, 35, 42, 46, 50, 53, 57, 62, 63, 65, 74, 79, 89, 95}; int numElements = 23; // Size of the Array is 23!!! int searchKey; int found; for(int i = 0; i < numElements; i++) cout << data[i] << ", "; cout << endl; for(;;) { cout << "Enter search key: (-1 to exit) "; // I want to quit when I press 'x'. Please let me know. cin >> searchKey; if(searchKey == -1) { cout << "Exiting\n"; break; } found = BinSearch(data, numElements,searchKey); if(found == -1) cout << searchKey << " not found\n"; else cout << searchKey << " is in position " << found << endl; } } int BinSearch(int data[], int numElements, int searchKey) { int mid; int beg = 0; int end = numElements; bool not_found = 1; // Algorithm Begins. for(int i = beg; i <= end;) { mid = (beg+end)/2; if(data[mid] == searchKey) return mid; else if(data[mid] > searchKey) end = mid - 1; else if(data[mid] < searchKey) beg = mid + 1; } return -1; } [/CODE] This doesn't seem to work. Sorry, I didn't completely understand what you meant... And Yea, the compiler's telling me this: warning C4715: 'BinSearch' : not all control paths return a value [/quote]
  7. Binary Search Help Repost.

    [quote name='szecs' timestamp='1340952968' post='4953859'] Some spoonfeeding: [code]found = BinSearch(data, numElements,searchKey); if( found == -1 ) { cout << Element not found << endl; } else // if( found >= 0 ) // for other error codes { cout << searchKey << " is in position " << found << endl; }[/code] [/quote] Thanks for replying. Did You mean this: [CODE] #include<iostream> using namespace std; int BinSearch(int data[], int numElements, int searchKey); // Prototype int main() { int data[] = {1, 4, 5, 6, 9, 14, 21, 23, 28, 31, 35, 42, 46, 50, 53, 57, 62, 63, 65, 74, 79, 89, 95}; int numElements = 23; // Size of the Array is 23!!! int searchKey; int found; for(int i = 0; i < numElements; i++) cout << data[i] << ", "; cout << endl; for(;;) { cout << "Enter search key: (-1 to exit) "; // I want to quit when I press 'x'. Please let me know. cin >> searchKey; if(searchKey == -1) { cout << "Exiting\n"; break; } found = BinSearch(data, numElements,searchKey); if(found == -1) cout << "Not Found!\n"; else cout << searchKey << " is in position " << found << endl; } } int BinSearch(int data[], int numElements, int searchKey) { int mid; int beg = 0; int end = numElements; // Algorithm Begins. for(int i = beg; i <= end;) { mid = (beg+end)/2; if(data[mid] == searchKey) return mid; else if(data[mid] > searchKey) end = mid - 1; else if(data[mid] < searchKey) beg = mid + 1; } return -1; } [/CODE] Not working. [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]
  8. Binary Search Help Repost.

    Thanks! No more warnings now. I'm returning -1 outside the for loop in the BinSearch function [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] But how do I print a message like "Element not found" using that return value -1 ?? Your English doesn't suck, I'm pure rookie [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]
  9. Binary Search Help Repost.

    @szecs Hey, thanks for your replyl! Do you mean this: [CODE] #include<iostream> using namespace std; int BinSearch(int data[], int numElements, int searchKey); // Prototype int main() { int data[] = {1, 4, 5, 6, 9, 14, 21, 23, 28, 31, 35, 42, 46, 50, 53, 57, 62, 63, 65, 74, 79, 89, 95}; int numElements = 23; // Size of the Array is 23!!! int searchKey; int found; for(int i = 0; i < numElements; i++) cout << data[i] << ", "; cout << endl; for(;;) { cout << "Enter search key: (-1 to exit) "; // I want to quit when I press 'x'. Please let me know. cin >> searchKey; if(searchKey == -1) { cout << "Exiting\n"; break; } found = BinSearch(data, numElements,searchKey); if(found == -1) cout << searchKey << " not found\n"; cout << searchKey << " is in position " << found << endl; } } int BinSearch(int data[], int numElements, int searchKey) { int mid; int beg = 0; int end = numElements; bool not_found = 1; // Algorithm Begins. for(int i = beg; i <= end;) { mid = (beg+end)/2; if(data[mid] == searchKey) return mid; else if(data[mid] > searchKey) end = mid - 1; else if(data[mid] < searchKey) beg = mid + 1; else return -1; } } [/CODE] This doesn't seem to work. Sorry, I didn't completely understand what you meant... And Yea, the compiler's telling me this: warning C4715: 'BinSearch' : not all control paths return a value
  10. Binary Search Help Repost.

    Damn! What was that?? Lol. I've reposted it [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]
  11. Binary Search Help Repost.

    [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]I've got the logic right and the algo seems to work fine. Now, that's epic for me [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] But..[/size][/font][/color] [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]I want to add 2 more features to this code:[/size][/font][/color] [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]1) Exit on pressing 'x'. For now I'm using -1 to exit.[/size][/font][/color] [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]2) Print a message "Element not found" when an element not present in the array is searched for. Yeah, I'm not able to figure that out :|[/size][/font][/color] [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]Well, Here goes my code:[/size][/font][/color] [font=verdana, arial, helvetica, sans-serif][color=#000000][size=3][CODE][/size][/color][/font] #include<iostream> using namespace std; int BinSearch(int data[], int numElements, int searchKey); // Prototype int main() { int data[] = {1, 4, 5, 6, 9, 14, 21, 23, 28, 31, 35, 42, 46, 50, 53, 57, 62, 63, 65, 74, 79, 89, 95}; int numElements = 23; // Size of the Array is 23!!! int searchKey; int found; for(int i = 0; i < numElements; i++) cout << data[i] << ", "; cout << endl; for(;;) { cout << "Enter search key: (-1 to exit) "; // I want to quit when I press 'x'. Please let me know. cin >> searchKey; if(searchKey == -1) { cout << "Exiting\n"; break; } found = BinSearch(data, numElements,searchKey); cout << searchKey << " is in position " << found << endl; } } int BinSearch(int data[], int numElements, int searchKey) { int position, mid; int beg = 0; int end = numElements; // Algorithm Begins. for(int i = beg; i <= end;) { mid = (beg+end)/2; if(data[mid] == searchKey) { return mid; } else if(data[mid] > searchKey) { end = mid - 1; } else if(data[mid] < searchKey) { beg = mid + 1; } } } [font=verdana, arial, helvetica, sans-serif][color=#000000][size=3][/CODE][/size][/color][/font] Thanks, --Sid
  12. Binary Search Help Repost.

    [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]I've got the logic right and the algo seems to work fine. Now, that's epic for me But..[/size][/font][/color] [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]I want to add 2 more features to this code:[/size][/font][/color] [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]1) Exit on pressing 'x'. For now I'm using -1 to exit.[/size][/font][/color] [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]2) Print a message "Element not found" when an element not present in the array is searched for. Yeah, I'm not able to figure that out :|[/size][/font][/color] [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3]Well, Here goes my code:[/size][/font][/color] [color=#000000][font=verdana, arial, helvetica, sans-serif][size=3][CODE][/size][/font][/color] #include<iostream> using namespace std; int BinSearch(int data[], int numElements, int searchKey); // Prototype int main() { int data[] = {1, 4, 5, 6, 9, 14, 21, 23, 28, 31, 35, 42, 46, 50, 53, 57, 62, 63, 65, 74, 79, 89, 95}; int numElements = 23; // Size of the Array is 23!!! int searchKey; int found; for(int i = 0; i < numElements; i++) cout << data[i] << ", "; cout << endl; for(;;) { cout << "Enter search key: (-1 to exit) "; // I want to quit when I press 'x'. Please let me know. cin >> searchKey; if(searchKey == -1) { cout << "Exiting\n"; break; } found = BinSearch(data, numElements,searchKey); cout << searchKey << " is in position " << found << endl; } } int BinSearch(int data[], int numElements, int searchKey) { int position, mid; int beg = 0; int end = numElements; // Algorithm Begins. for(int i = beg; i <= end;) { mid = (beg+end)/2; if(data[mid] == searchKey) { return mid; } else if(data[mid] > searchKey) { end = mid - 1; } else if(data[mid] < searchKey) { beg = mid + 1; } } } [CODE] Thanks, --Sid
  13. Programming Language for Multiplayer Programming

    Thanks for all the wonderful replies. I think I'll stick with C++ [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  14. Programming Language for Multiplayer Programming

    Hey thanks for your reply! I'm currently learning C++ The learning curve seems steep. But I'm just pushing myself [img]http://public.gamedev.net//public/style_emoticons/default/huh.png[/img] When a large program runs I'm motivated else a bit restless [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]
  15. Which Languages are used for specifically Multiplayer Programming in Games? I've basic knowledge of Computer Networks and would also be having Advanced Computer Networks soon and also "High Speed Network Architecture and Protocols, Neural Networks later" in my college..Will these subjects help me in learning Multiplayer Programming? I'm interested in Networking altogether. So how does Networking come in games and which languages are used? I'm new to programming and have begun with C++. Sorry for not narrowing my question. In short please enlighten me about multiplayer programming in games... Thanks, --Sid