Hi, i was working on a code for a vending machine and i do consider myself to be a beginner, anyway i feel my code is much longer than it needs to be and i want someone to show me a new, shorter way of presenting it. import time print ("Welcome to the Python Vending Machine.") # Asking the user how much money they wish to enter. number_of_10p = int(input("How many 10 pence coins would you like to insert? ")) while number_of_10p < 0: number_of_10p = int(input("Please enter a positive number.")) number_of_20p = int(input("How many 20 pence coins would you …

Member Avatar
Member Avatar
+0 forum 5

I'm a beginner in C++. I saw \b and \r in a program source code. I've seen \n and I know its purpose. But why do we use \r and \b in C++? Please clear my doubt. Thank You.

Member Avatar
Member Avatar
+0 forum 8

Hey guys, hope you all are having a nice day? I want us to discuss about game development projects. As a beginner, participating in game development project is a good way to learn. I am part of a game devlopment project/ Tutorial with the title [How to create a Multiplayer Space Game in C#](https://www.liveedu.tv/redironlabs/lznVY-how-to-create-a-multiplayer-space-game-in-c/). It has being a great experience for me, watching and asking questions. So what project do you have to suggest so that i can join. Please drop only game development projects. Thanks

Member Avatar
Member Avatar
+0 forum 2

Good morning everyone, The library will be home, 0800 till 2100. I've been working on trying my loops in my hailstone sequence into recursions. It seem recursion can easrier to do, instead of creating loops. I say seem, because now I have come to halt on my progress. The halt is in the form of my sequence_Max function: /* //sequence_Max(int n) //Returns the largest value in the //hailstone sequence starting at 'n'. */ int sequence_Max(int n) { //Variable Declaration. int max = n, temp = n; while (temp > 1) { temp = next(temp); if(temp > max) { max = …

Member Avatar
Member Avatar
+0 forum 29

The problem asks: Write a program that prompts the user to enter an integer from 1 to 15 and displays a pyramid, as shown in the following sample run: Enter number of lines: 7 [CODE=text]......1 .....212 ....32123 ...4321234 ..543212345 .65432123456 7654321234567[/CODE] (except the example given shows spaces in between the #s in the pyramid & did NOT include the "." I'm using those for placeholders - this is supposed to look like a perfect pyramid - all of the 1's are in a vertical column, all the 2's are in a vertical column, etc.) I understand how to get the …

Member Avatar
Member Avatar
+0 forum 16

when the console displays the "StudentAns" I get weird characters instead of the actual answer. ///////////////////////////////////////////////////////////// this is the files CorrectAnswers.txt A D B C A A D B D C A D B A C C D B C A StudentAnswers.txt A D B C A A D B D C A D B A C C D B C A

Member Avatar
Member Avatar
+0 forum 1

I currently have a problem where the program when it is running will also choose one word and one letter in the word file. For example, in the word file the program only chooses the 2nd word "Dependent" The only letter that is considered correct is "d" My code is : #include <iostream> #include <fstream> #include <string> using namespace std; string LoadFile(); void RunProgram(string word); void displayHangMan(); string LoadFile() { int counter = 0; ifstream textfile; string s; string words[20]; textfile.open("wordfile.txt"); for (counter = 0; !textfile.eof(); counter++) { getline(textfile, s); words[counter] = s; } int r = rand() % counter; …

Member Avatar
Member Avatar
+0 forum 2

on my university I got an assignment to build a program on OpenGl that read from a given txt file a coordinates of some lines and draw them to the screen. i thank everyone that might help me, I know a little bit programming on C but I'm a little confused when it connects with OpenGl. Thanks a lot.

Member Avatar
Member Avatar
+0 forum 1

I don't know how to programm but i wana that u help me

Member Avatar
Member Avatar
+0 forum 6

void PatratTexturat(PATRAT patrat, int numar) { switch(numar) { case 1: if(numar==1) glBindTexture(GL_TEXTURE_2D, id_textura[2]); else glBindTexture(GL_TEXTURE_2D,id_textura[3]); break; case 2: if(numar==2) glBindTexture(GL_TEXTURE_2D, id_textura[4]); else glBindTexture(GL_TEXTURE_2D, id_textura[5]); break; case 3: if(numar==3) glBindTexture(GL_TEXTURE_2D, id_textura[6]); else glBindTexture(GL_TEXTURE_2D, id_textura[7]); case 4: if(numar==4) { glBindTexture(GL_TEXTURE_2D, id_textura[8]); } else { glBindTexture(GL_TEXTURE_2D, id_textura[9]); } break; case 5: glBindTexture(GL_TEXTURE_2D,id_textura[10]); break; case 6: glBindTexture(GL_TEXTURE_2D,id_textura[11]); break; case 7: glBindTexture(GL_TEXTURE_2D,id_textura[12]); break; case 8: glBindTexture(GL_TEXTURE_2D,id_textura[13]); break; case 9: glBindTexture(GL_TEXTURE_2D,id_textura[14]); break; default: glBindTexture(GL_TEXTURE_2D, NULL); break; } glBegin(GL_QUADS); glTexCoord2f(0.0,0.0); glVertex2f(patrat.stanga,patrat.jos); glTexCoord2f(1.0,0.0); glVertex2f(patrat.dreapta,patrat.jos); glTexCoord2f(1.0,1.0); glVertex2f(patrat.dreapta,patrat.sus); glTexCoord2f(0.0,1.0); glVertex2f(patrat.stanga,patrat.sus); glEnd(); } I have the code above and i get the error that `case` may only be used in a …

Member Avatar
Member Avatar
+0 forum 4

void PatratTexturat(PATRAT patrat, int numar) { switch(numar) { case 1: if(numar==1) glBindTexture(GL_TEXTURE_2D, id_textura[2]); else glBindTexture(GL_TEXTURE_2D,id_textura[3]); break; case 2: if(numar==2) glBindTexture(GL_TEXTURE_2D, id_textura[4]); else glBindTexture(GL_TEXTURE_2D, id_textura[5]); break; case 3: if(numar==3) glBindTexture(GL_TEXTURE_2D, id_textura[6]); else glBindTexture(GL_TEXTURE_2D, id_textura[7]); case 4: if(numar==4) { glBindTexture(GL_TEXTURE_2D, id_textura[8]); } else { glBindTexture(GL_TEXTURE_2D, id_textura[9]); } break; case 5: glBindTexture(GL_TEXTURE_2D,id_textura[10]); break; case 6: glBindTexture(GL_TEXTURE_2D,id_textura[11]); break; case 7: glBindTexture(GL_TEXTURE_2D,id_textura[12]); break; case 8: glBindTexture(GL_TEXTURE_2D,id_textura[13]); break; case 9: glBindTexture(GL_TEXTURE_2D,id_textura[14]); break; default: glBindTexture(GL_TEXTURE_2D, NULL); break; } glBegin(GL_QUADS); glTexCoord2f(0.0,0.0); glVertex2f(patrat.stanga,patrat.jos); glTexCoord2f(1.0,0.0); glVertex2f(patrat.dreapta,patrat.jos); glTexCoord2f(1.0,1.0); glVertex2f(patrat.dreapta,patrat.sus); glTexCoord2f(0.0,1.0); glVertex2f(patrat.stanga,patrat.sus); glEnd(); } I have the code above and i get the error that `case` may only be used in a …

Member Avatar
Member Avatar
+0 forum 2

How do I modify minhook in order to be able to hook undocumented functions? I'm a beginner and this is beyond me.

Member Avatar
Member Avatar
+0 forum 1

Hi, I am currently in UNI studying Media (Video, Music, Design and also Web Development). As its summer I would love to have a side project. I've been meaning to learn how to create a text based RPG game, I am curious what skills I would need to make a similar game to this game below. I am highly skilled in HTML5 & CSS as well as bootstrap but I am wondering how much harder would it be to aquire the skills for the game below. Link: [Click Here](http://www.syrnia.com) Screenshots: http://www86.zippyshare.com/v/4CdaqBJz/file.html http://www86.zippyshare.com/v/kfA59sBM/file.html

Member Avatar
Member Avatar
+0 forum 1

I'm Python beginner. I'm trying to write a loop over a class and compare different results. Results are produced in a method called job. Then in each loop I want to run this method of the class. The last line of the code does not work. What is the possible solution? Here is an example: class test: def __init__(self,a) ... def job(self,x): ... a = 5 # arbitrary numebr instance_names = ['model_1', 'model_2', 'model_3'] for i, name in enumerate(instance_names): model_name = 'CC' + name model_job = model_name + '.job' vars()[model_name] = test(a) model_job(i)

Member Avatar
Member Avatar
+0 forum 1

//thanks to GameAlchemist function createCountDown(timeRemaining) { var startTime = Date.now(); return function() { return timeRemaining - ( Date.now() - startTime ); } } var currentCountDown = createCountDown(30000); // Draw everything var render = function () { var countDownValue = currentCountDown(); returnKillsNeeded(stageNum); ctx.drawImage(startGameImg, 0,0); ctx.font = "24px Helvetica"; ctx.textAlign = 'center' ctx.textBaseline = "top"; ctx.fillStyle="#FF0000"; ctx.fillText("press Enter to play", 250, 450); ctx.fill(); if(gameStart){ if (bgReady) { ctx.drawImage(bgImage, 0, 0); } ctx.fillStyle="#522900"; ctx.fillRect(0,480,500,120); ctx.drawImage(scoreImg, 22,522); ctx.drawImage(livesImg, 360,522); ctx.drawImage(progressImg, 200,492); createProgressBar(); createProgressPercent(); ctx.fillText("progress", 170,492); setEnemyHealthText(); drawPlayer(); if(countDownValue <=0){ countDownValue = 0; }else{ ctx.fillText(countDownValue, 200,190); }

Member Avatar
Member Avatar
-1 forum 4

I am a beginner in computer programming and need help with this problem: Create a script that prompts the user to provide the number of pennies, nickels, dimes, and quarters. Display back the value of the coins in dollars and cents. Here is my code so far, everything is good except it doesn't properly display the number of cents left over. For example; if the total is $1.76 it will say "you have 1 dollar and 1 cent(s). Thanks so much for any tips/help. def main(): pennies = int(input("Enter pennies:")) nickels = int(input("Enter nickels:")) dimes = int(input("Enter dimes:")) quarters = …

Member Avatar
Member Avatar
+0 forum 3

I want to know more about Bittorrent . Like , how it works . I'm not looking for an overview as i have a little knowledge about it . I want a deeper and a technical insight to it . Maybe if I could somehow get hold of the code . As i'm a total beginner it would be nice if anyone could suggest me a book about computer networking which will eventually help me understanding the Bittorrent protocol better . Thank you .

Member Avatar
Member Avatar
+0 forum 6

Hello! I have to print patterns using '*' and I am at a loss how to get these patterns printed! I figured out the first one, * ** *** **** ***** ****** ******* ******** ********* ********** and now i have to do it upside down: ********** ********* ******** ******* ****** ***** **** *** ** * and backwards: ********** _********* __******** ___******* ____****** _____***** ______**** _______*** ________** _________* and _________* ________** _______*** ______**** _____***** ____****** ___******* __******** _********* ********** this is the code i have for the first one: [CODE] for (int i =0; i < 10; i++) { for (int …

Member Avatar
Member Avatar
+0 forum 16

I'm developing a game that has a word falling to the bottom of the screen and the user typing that word before it hits the bottom. So you'll be able to type input while the word is falling. Right now I have a timer that waits 5 seconds, prints the word, runs timer again, clears the screen, and prints the word down 10 units. int main() { for (int i = 0; i < 6; i++) { movexy(x, y); cout << "hello\n"; y = y + 10; wordTimer(); } } Very basic I know. Which is why I thought multithreading …

Member Avatar
+0 forum 0

it says the following: Write a function that converts the time to 24hr format. Examples [CODE] >>> time24hr('12:34am') '0034hr' >>> time24hr('12:15pm') '1215hr' [/CODE] so i wrote the following: [CODE] def time24hr(tstr): a = tstr.split(':') am = {'12':'00','1':'01','2':'02','3':'03','4':'04','5':'05','6':'06', '7':'07','8':'08','9':'09','10':'10','11':'11'} pm = {'12':'12','1':'13','2':'14','3':'15','4':'16','5':'17','6':'18', '7':'19','8':'20','9':'21','10':'22','11':'23'} if 'am' in tstr: return am[a[0]] + a[1][:2] + 'hr' elif 'pm' in tstr: return pm[a[0]] + a[1][:2] + 'hr' [/CODE] But what would have been a better way to do it? i imagine their is an inbuilt method of doing this, but is there a more efficient way to do this without inbuilts? and could you show …

Member Avatar
Member Avatar
+0 forum 5

I'm very new to the Raycasting algorithim, and was reading a webpage on how it works with CPP code to accompany. I followed what the page described and converted it into Python/Pygame and then ran it, but my result was *very* different. I have a feeling it has something to do with try: deltaDistX = sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX)); deltaDistY = sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY)); except ZeroDivisionError: pass Here is the code I wrote: http://pastebin.com/nLW6ELvv And here is the webpage on Raycasting: http://lodev.org/cgtutor/raycasting.html Help is appreciated <3

Member Avatar
Member Avatar
+0 forum 1

Hey, still a beginner in Python. I was wondering if anybody could help me out with all this info. Im planning to make an actual game, but first i have to get classes/methods etc. I thought maybe this would be some good classes: Trainer, Pokemon, Moves, Stats, Type, Pokeball, Pokedex There is so much stuff to incorporate i dont know what to put where. any help would be great

Member Avatar
Member Avatar
+0 forum 3

I was wondering what you all thought on web development platforms that enable users with no programming knowledge to create websites for example http://www.wix.com . I personally think that a web developer should want to know how all the components work and build websites from scratch component to component. But this has a disadvantage because it takes time and as a beginner seems like too much work also managing is going to take alot of work but if you are like me and you love to know how your software / app / site works wont take as much time …

Member Avatar
Member Avatar
+0 forum 4

Hi there, As an excerise I am trying to create a basic PHP blog. Creating the user login system was pretty straightforward, and I've 2 mySQL tables, one with user information, and one with the blog information (and with a foreign key referencing the user id). However, I'm stuck for what to do next. Searches online don't seem to walk me through what I am after. Would somebody be able to point me vaguely in the right direction, such as what I should be looking into? Basically, one method to populate a page with content that looked promising was using …

Member Avatar
Member Avatar
+0 forum 3

I am a beginner programmer and have been learning about how to use Java since February 2015 of this year. However, I just started learning how to write code in the Python Language, a few weeks ago and find it to be much easier to work with. My goal here is to create a simple Note pad program from scratch using Python and I need assistance please. This will be my first full program created! I want to get my feet wet, and get used to writing programs so that I can possibly do Freelance work/projects.I have wrote some code …

Member Avatar
Member Avatar
+0 forum 1

There has been a noticeable increase in people asking where to start C# recently. So I have been across a couple of forums and pulled together a list of some useful links and resources. # Web Tutorials # [Home and Learn Tutorial](http://www.homeandlearn.co.uk/csharp/csharp.html) [CodeProject Tutorial P1](http://www.codeproject.com/Articles/219869/Object-Oriented-Programming-in-Csharp-NET) [CodeProject Tutorial P2](http://www.codeproject.com/Articles/222295/Object-Oriented-Programming-in-Csharp-NET-Part-2) [CodeProject Tutorial P3](http://www.codeproject.com/Articles/222329/Object-Oriented-Programming-in-Csharp-NET-Part-3) [CodeProject Tutorial P4](http://www.codeproject.com/Articles/222339/Object-Oriented-Programming-in-Csharp-NET-Part-4) [CodeProject Tutorial P5](http://www.codeproject.com/Articles/222493/Object-Oriented-Programming-in-Csharp-NET-Part-5) [DreamInCode - Debugging](http://www.dreamincode.net/forums/topic/186780-debugging/) # Helpful Tips # [DreamInCode - How to efficiently search the Internet](http://www.dreamincode.net/forums/topic/238988-getting-what-you-need-by-doing-a-decent-search-of-the-internet/) [DreamInCode - Debugging Tips](http://www.dreamincode.net/forums/topic/215619-debugging-tips-for-c%23/page__utm_source__sendgrid__utm_medium__email__utm_campaign__forum_notifications) [Little Wonders and Little Pitfalls](http://www.geekswithblogs.net/BlackRabbitCoder/archive/2015/04/02/c.net-little-wonders-amp-little-pitfalls-the-complete-collection.aspx) # Useful Resources # *These may be slightly more advanced than 'beginner'* [C# Book Downloads](http://www.csharpcourse.com/) [Blog - Mastering VS2010 …

Member Avatar
Member Avatar
+16 forum 26

hi.i realy need help am a new beginner in java.so i have been trying to do a code in java that returns the largest counter,refering to my libraries.so i was trying to invoke the method comparTo,so i dont know how to use it to compare all counter arrays so that i could the largest one for( i=1;i<n;i++) { if(arr[i].compareTo(arr[i+1])>0) { System.out.println(arr[i] + "largst count"); }

Member Avatar
Member Avatar
+0 forum 3

I created a 2D array and filled it with random values from 0 to 100 and now i'm trying to find the average and maximum number of all the value inside it. But i'm having serious problems understanding the problem with my functions and how to connect them in the main function (i'm a total C beginner). Please help me understand the problem with my average and find maximum functions. (the average functions its telling me that expected a declaration before i, which is "float sum=0.0;" but i haven't been able to fix that yet.) Any recommendations? are my functions …

Member Avatar
Member Avatar
+0 forum 1

Hi Guys I am beginner in PHP i am getting Warning: mysql_fetch_array(): Eror... anybody help me Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home4/kksivash/public_html/drngpit/student-portal/admin/model.php on line 76 function get_deptbyID($id=""){ $sql = "SELECT * FROM department where id = ".$id; $result = mysql_query($sql); $row = mysql_fetch_array($result); while ($row = mysql_fetch_array($result, MYSQL_NUM)) return $row; } Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home4/kksivash/public_html/drngpit/student-portal/admin/model.php on line 138 function get_semID($id="",$year=""){ $sql = "SELECT sid,sname,year,did FROM semester where did =".$id." ORDER BY sname ASC" ; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ $res[] = $row; } …

Member Avatar
Member Avatar
+0 forum 2

**I want a C++ program that when build up in TURBO C++ then it will produce an output, which shows file system on my computer being used. I am beginner and dont know how to write this program. please help me. Thanks**

Member Avatar
Member Avatar
+0 forum 3

The End.