Consider my post in this thread... https://www.daniweb.com/programming/software-development/threads/508038/how-to-change-this-program-to-fully-oop Consider this code... int main() { srand(time(NULL)); char enter; // game starts Player player; // title cout << "Welcome to Zombie War." << endl << "Press [ENTER] to start."; cin.get(); // player name cout << "Please enter your name: "; cin >> player.playerName; // ask how many zombies cout << "How many zombies do you wish to fight? "; cin >> player.zombieCount; cout << "Get ready to fight for your life, " << player.playerName << "!" << endl; Line 5 above ("game starts" comment) is line 19 in the OP's code since I … |
+0 forum
1 | ||

Hi, I hope you can help me out of this because i really dont understand how to fix this code anymore, i tried and tried and it don't work. When i debug this code in Microsoft Visual Express 2010, it says the following erros are: 1>------ Build started: Project: Adreesbook2, Configuration: Debug Win32 ------ 1> adressbook2.cpp 1>c:\users\twice\documents\visual studio 2010\projects\adreesbook2\adreesbook2\adressbook2.cpp(37): error C2297: '>>' : illegal, right operand has type 'Node *' 1>c:\users\twice\documents\visual studio 2010\projects\adreesbook2\adreesbook2\adressbook2.cpp(37): error C2446: '==' : no conversion from 'int' to 'Node *' 1>Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast 1>c:\users\twice\documents\visual studio … |
+0 forum
3 | ||

This program challenge was given to me by my Professor for extra credit. He said it includes some programming that we haven't learned yet in our C++ class. Messed up... Ideally I would love if someone would do this for me, but we all know that's not happening. lol Anyways...could anybody offer an idea of what I would do/use? [COLOR="Green"]"Write a program that will convert Roman numerals to Arabic numbers or Arabic numbers to Roman numerals. Your program should prompt the user to select the type of conversion they would like to perform, Roman to Arabic or Arabic to Roman, … |
+0 forum
14 | ||

I am writing a python program on Windows using Python 2.7. Basically, it's a program that takes a 5-digit, negative & positive, number from user & spells it out in English using num2word & then speaks it out too. I have used espeak & pyttsx both but i'm getting errors in all of them. I have tried this: num = raw_input('Please enter your 5 digit number:') while len(num) != 5 or (not num.isdigit()): print 'Not a 5 digit number' num = raw_input('Please enter your 5 digit number:') num = int(num) def spellnum(num,join=True): #Lists of number words thousands = ['','thousand','million'] tens … |
+0 forum
2 | ||

Hello, i need help with my project. Im making a program that encrypts and decrypts the contents of a text file. I had to generate an 8 character key which is converted to ascii and then calculate the offset factor of the key that was generated (New every time program is run) next i converted the contents of the user specified text file to ascii characters and added them to the offset factor calculated earlier, I need some help with this part though, it prints the (so far) the encrypted text and then adds it to offset factor, but the … |
+0 forum
0 | ||

Hi guys, I have written a program which currently accumalates different pairs and their frequency from an excel spreadsheet. (1280 pairs) Want I want to achieve is from the top 20/30 pairs, if I can find pairs that link e.g. Pair 1 [1,33] and Pair 100 [1,232] so i would expect that to be a link. With that link i want to be able to merge it so the the value becomes e.g. [33,1,232] before continue to find any more. My find outcome should be a set of 10 numbers which are linked together by thier pairs. Anyone one have … |
+0 forum
3 | ||

Code Snippet
Some number tricks (golang) Just a couple of number tricks to check Go's mathematical abilities. If you have more, let's show them here. |
+2 forum
1 | ||

Code Snippet
A slice of prime numbers (golang) Another translation of one of my Python snippets. This function will return a slice of consecutive prime numbers from 2 to a given value limit. In Go the 'int' type (int32) will go as high as 2147483647, but you can replace 'int' with 'uint64' and go as high as 18446744073709551615. |
+1 forum
0 | ||

Hey, guys. A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a² + b² = c². For example, 3² + 4² = 9 + 16 = 25 = 5². There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. #include <iostream> using namespace std; int a = 0; int b = 0; int c = 0; bool Found = false; int Find_Triplet(int,int,int); int Find_Triplet(int a, int b, int c) { for (int i = 5; i < 1000; i++) { c = i; … |
+0 forum
8 | ||

Hello, guys. This challenge asks us to find the 10001-th prime. Here's my code: // A reasonable approximation is to say that the n-th prime is such that p(n) = n*(log n + log*(log n) - 1). // With that in mind, we can say that the 10001-th prime is smaller than 10100*(log 10100 + log(log 10100) - 1), which we can round to 105000. #include <iostream> #include <cmath> #define MAX_INTERVAL 105000 using namespace std; int Wanted_Prime = 0; void Show_Prime(int); void Show_Prime(int Wanted_Prime) { cout << "The 10001-th prime is " << Wanted_Prime << endl; } int main() { … |
+0 forum
9 | ||

Hello, guys. The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 62229893423380308135336276614282806444486645238749 30358907296290491560440772390713810515859307960866 70172427121883998797908792274921901699720888093776 65727333001053367881220235421809751254540594752243 52584907711670556013604839586446706324415722155397 53697817977846174064955149290862569321978468622482 83972241375657056057490261407972968652414535100474 82166370484403199890008895243450658541227588666881 16427171479924442928230863465674813919123162824586 17866458359124566529476545682848912883142607690042 24219022671055626321111109370544217506941658960408 07198403850962455444362981230987879927244284909188 84580156166097919133875499200524063689912560717606 05886116467109405077541002256983155200055935729725 71636269561882670428252483600823257530420752963450 Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product? Here's how I did it: #include <iostream> #include <string> #include <vector> using namespace std; string Grid_of_Numbers = "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "66896648950445244523161731856403098711121722383113" "62229893423380308135336276614282806444486645238749" "30358907296290491560440772390713810515859307960866" "70172427121883998797908792274921901699720888093776" "65727333001053367881220235421809751254540594752243" "52584907711670556013604839586446706324415722155397" "53697817977846174064955149290862569321978468622482" "83972241375657056057490261407972968652414535100474" "82166370484403199890008895243450658541227588666881" "16427171479924442928230863465674813919123162824586" "17866458359124566529476545682848912883142607690042" "24219022671055626321111109370544217506941658960408" "07198403850962455444362981230987879927244284909188" … |
+0 forum
7 | ||

Hello, guys. Here's the challenge: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? I wrote my code: #include <iostream> #include <cmath> using namespace std; #define MAX_VALUE 2793510720 unsigned int Smallest_Evenly_Divisable = 0; void Show_Number(unsigned int); void Show_Number(unsigned int Smallest_Evenly_Divisable) { cout << "\n\n" << Smallest_Evenly_Divisable << endl; } int main() { unsigned i = 0; for (i = 2520; i < MAX_VALUE; i++) { if ( i % … |
+0 forum
7 | ||

Sorry for the misleading question guys, I know how to generate two random numbers but I want to use them in One JOptionPane input Dialogbox so the user can add the two numbers. Below is my code of what I have done so far I know it's not a lot but I am genuinely stumped on what to do next :-/ Any help is much appreciated! :) import javax.swing.*; public class Practical13 { /** * @param args the command line arguments */ public static void main(String[] args) { String input = null; double ipt; ipt = Double.parseDouble(input); ipt = Math.floor((Math.random() … |
+0 forum
2 | ||

I copied this code from page 11 of http://personal.denison.edu/~krone/cs173/files/PythontoC++.pdf and assigned it to a Python string. Alas there are still line numbers. How could I use Python to remove these? Help, I have a mental block. s = ''' 1 #include <iostream> 2 using namespace std; 3 4 int gcd(int u, int v) { 5 int r; 6 while (v != 0) { 7 r = u % v; // compute remainder 8 u = v; 9 v = r; 10 } 11 return u; 12 } 13 14 int main( ) { 15 int a, b; 16 cout << … |
+0 forum
2 | ||

Hi Friends, I want to do a project for Parsing Resume in C#. i.e when we upload resumes(More than 100), it should extract Name, email id, phone no, skills. **Please don't tell that software’s are available. I tried those soft wares, but they are not working properly.** So, I wanted to do by myself. Please Help me. |
+0 forum
1 | ||

I am needing to write a program for someone that needs it to count by any number they manually enter into the program. I have the menu code written and now just need help with the counnting code. I know i most likely need to use a "for" loop but after that i am not sure. |
+0 forum
5 | ||

I want a set of not the same numbers to be added to a listbox, if there are any numbers that are the same, then they won't be added. I tried: If (Number1 = Number2) Or (Number1 = Number3) Or (Number1 = Number4) Or (Number1 = Number5) = False Then ListBox1.Items.Add(Number1 & " " & Number2 & " " & Number3 & " " & Number4 & " " & Number5) End If However I still got ## 10 10 50 29 36 13 ## the first two numbers are of the same value, and yet they somehow managed to … |
+0 forum
7 | ||

I've made a timer and six labels. Then a number is being generated for each label seperately. After testing how it works, I found out that sometimes two same numbers are being generated at the same time. In the picture attachment you can see how two numbers were generated at the same time. I was wondering if it's possible to prevent the random generation of two numbers at the same time for the numbers in the blue box. Here is the code that is in the timer: Randomize() Dim Number1, Number2, Number3, Number4, Number5, Number6 As Integer Number1 = Int(Rnd() … |
+0 forum
21 | ||

I am trying to do a search for sub-folders in a directory that conaint numbers. The format could be a date range for example: 1-1, 01-1, 1-01, 01-01. The first number will only go up to 12 and the second one will go as high as 31 and im trying to figure out how to read the date of files that are in there then once it finds the correctly formated file name it kicks off the code to go into that file and do what else my code is set to do . If there is a simple way … |
+0 forum
20 | ||

#include<stdio.h> int main() { int pcheck=1,i; int k=1000 for(i=2;i<k;i++) { if((k%i)== 0) { pcheck=0; break; } } if(pcheck) { printf("%d is a prime .\n",k); } else { printf("%d is not a prime.\n",k); } return 0; } this code works to check any number i that write in k but when i put a do while loop.stating that do while should loop while k!=0 then i k-- so that can check if all the number less than 1000 are prime. it prints all not prime..please guys help me |
+0 forum
4 | ||

#include<stdio.h> #include<math.h> int main() { int n,nstart,nstop,nstep,i,j,zNumber; ` printf("Please enter a value of a positive integer nstart: "); scanf("%d",&nstart); printf("Please enter a value of a positive integer nstop: "); scanf("%d",&nstop); printf("Please enter a value of a positive integer nstep: "); scanf("%d",&nstep); printf("Number\t\tzNumber\n"); printf("------\t\t-------\n"); n=nstart; zNumber= double pow(double_n,double_i); while(i<=nstop){ zNumber = 1; i=1; while(i<=n){ zNumber +=i; i++; } printf("%d\t\t%d\n",n,zNumber); n += nstep; } return 0; } |
+0 forum
9 | ||

Hello, I have a quick question about c/c++ syntax. Basically I am wondering when it is allowable to have numbers in identifiers. My compiler happens to allow numbers in: * Function names * Class names * Variable names * Pre-processor names As long as they do not begin with numbers. Is this standard functionality? I just ask because it feels weird to have a function called euler2 (for calculating eulerian numbers of the second kind). Is there any reason I should rename it to eulerTwo? I checked the ISO C specification and it seems to suggest that it should be … |
+0 forum
3 | ||

Good time of day! I'm working on creating an Eulers Method Calculator program. The problem I got stuck on is I don't know how to convert the user's string into a Differential Equation (dy/dx). This is what I have so far: import static java.lang.System.*; import java.util.Scanner; class EulersMethod { public static void main(String args[]) { double xcor, ycor, delx, dely, xcorplusdelx, ycorplusdely, fx; String dydx; Scanner input = new Scanner(System.in); out.print(" Enter x coordinate "); xcor = input.nextDouble(); out.print(" Enter y coordinate "); ycor = input.nextDouble(); out.print(" Enter delta x "); delx = input.nextDouble(); out.print(" Enter dy/dx "); dydx = … |
+0 forum
5 | ||

[b]TEAM A[/b]: includes members whose BC username start with A C E G I K M O Q S U V W [b]TEAM B[/b]: includes members whose BC username start with B D F H J L N P R T X Y Z [b]SCORE Board[/b] Team A: 4 Team B: 0 Team A leading the way :-) [b]Rules: * Team A members has to Add(+) 2 from the previous post * Team B members has to Subtract(-) 2 from the previous post * If it reach 1,000. Team A is the Winner * If it reach 0. Team B … |
+9 forum
15,008 | ||

Hello, I have used taylor polynomials to approximate floating-point values before. I am wondering whether there is a way to still apply them to functions with complex arguments, and if there is a way what its constraints would be. For example, to calculate the sine of a floating-point number to a specific precision I keep adding terms until the error value is less than the precision. However, I noticed (by testing it with the taylor expansion of ln(x) ) that this gives the wrong value when I use complex numbers (with the standard operators appropriately defined). For example: ln(0.5)~=-(0.5+(0.5^2)/2+(0.5^3)/3) --- … |
+0 forum
1 | ||

hello guys..can someone help me to create a function that generates random numbers composing of 9 digits with the ff limitations.. * must not have consecutive numbers in any place...sample 158461247....1 and 2 is consecutive numbers... * must not have same numbers before and after....sample 155483628....5 and 5 is same number... Hoping that anyone will help me regarding this matter.Thanks in advance... |
+0 forum
6 | ||

[code]#include <iostream> using namespace std; long int math; long int check; long int divider = 1; long int inputnum; void dividerp(); void counter(); void inputp(); void dividerp(){ math = inputnum/divider; if (math == 1 or inputnum == 2 or inputnum == 1){ cout<<"You do have a prime number there!"<<endl; system("PAUSE"); system("CLS"); math = 0; inputp(); } else if (math == inputnum){ counter(); } else if ( inputnum % divider != 0 ){ counter(); } else if (math >= 1){ cout<<"You do not have a prime number!"<<endl; system("PAUSE"); system("CLS"); math = 0; inputp(); } else{ counter(); } } void counter(){ divider … |
+0 forum
6 | ||

I've cust_name and install_no columns in table, each customer's name repeated 12 times as rows how to insert numbers 1 to 12 in install_no column for all rows. table sample: ----------------------------- cust_name | install_no ---------------------------- ROGER | 1 ---------------------------- ROGER | 2 ---------------------------- ROGER | 3 ---------------------------- ROGER | 4 ---------------------------- ROGER | 5 ---------------------------- ROGER | 6 ---------------------------- ROGER | 7 ---------------------------- ROGER | 8 ---------------------------- ROGER | 9 ---------------------------- ROGER | 10 ---------------------------- ROGER | 11 ---------------------------- ROGER | 12 ---------------------------- JAMES | 1 ---------------------------- JAMES | 2 ---------------------------- JAMES | 3 ---------------------------- JAMES | 4 ---------------------------- JAMES … |
+0 forum
2 | ||

I am creating a simple area calculator that exhibit overloading. I already finished the overloading function, my concern is, I want to key trap the pressed letters/characters by the user. I want to allow only numbers (int & float data type) input. How will I do that? Thanks. I am using Dev C++. Here is some part of my code: if (yourchoice ==1){ cout << "\n---- Area of Square ----"; cout <<"\nSide of Square: "; cin >> SqSide; int AreaSquare=area(SqSide); cout<<"\n Area of a Square is = "<<AreaSquare << endl; }else if (yourchoice ==2){ cout << "\n---- Area of Rectangle … |
+0 forum
3 | ||

this is my code, when even i run it it tells me that the number is even while it is odd. #include<stdio.h> #include<stdlib.h> int main(void) { int value; /* To read a number and say wheither it is even or odd*/ printf("Please enter any number \n"); scanf("%u", &value); if (value/2 != 0) printf("the number is Even \n"); else printf("the number is Odd \n "); printf("The value is %u \n",value*10); return 0; } please help me out in getting the code to work in the right way that i want it to. |
+0 forum
1 |

The End.