Visual C++ :: Nim Project - Not Displaying Matches But Display Correct Number

Apr 9, 2013

I am having one issue with my project. We are making a game of Nim code.I'm 99% done with it, i worked hard on it and i feel like i did a good job, however my project is not displaying the matches i want. For example, it display's the inital number of them 23. But once the first player subtracts a number, it doesn't display matches for player 2, just the number of matches remaining. Then as i keep running the program the same thing happens. This is what it's supposed to
output:

"Input/Output sample
WELCOME TO NIM
------- -- ---
Enter the starting player's name (no spaces)-->John
Enter the second player's name (no spaces)-->Mary
There are 23 matches.
ooooooooooooooooooooooo
|||||||||||||||||||||||
Player John please enter the number of matches to remove-->2
There are 21 matches.
ooooooooooooooooooooo
|||||||||||||||||||||
Player Mary please enter the number of matches to remove-->3
There are 18 matches.
oooooooooooooooooo
||||||||||||||||||
Player John please enter the number of matches to remove-->1 "

This is entire code.

#include <iostream>
#include <string>
using namespace std;
int main() {
// Holds variables.

[Code] ....

I will attach my code as well.ProjectNim.cpp

View 7 Replies


ADVERTISEMENT

Visual C++ :: Project To Display Raw Image

Nov 25, 2012

Used some online code example to put a little project to display raw image. The display does not seem to work.For some purposes, I like this to work with a dialog based MFC project.XDVView is derived from CScrollView.

See OnInitDialog() and OnDraw(CDC* pDC).8bit 768x756

View 14 Replies View Related

C++ :: Displaying Correct Output By Using For Loop (with Pointers)

Feb 4, 2014

I wanted to display the correct output by using a for loop at the end of my code, but for some reason it's not working correctly.

#include <iostream>
using namespace std;
int main() {
int* ipArray[3];
for(int i = 0; i < 3; i++) {
ipArray[i] = new int [5];

[Code] .....

What I wanted to do is pretty much match my 1st out put like 0 1 2 3 4 but my 2nd output only outputs 24's and I don't know why

View 11 Replies View Related

C :: Recursive Function Not Displaying Correct Sequence Request

Jul 1, 2013

Ok, so the assignment is to use a recursive function to display a request for a certain position in the Fibonacci Sequence (0, 1, 1, 2, 3, 5, 8, 13...)

The program I have written works, but it displays the wrong number in sequence. The book says that when you enter "8" you should receive "13", which is correct in the order of the sequence, though my program is producing "21" which is the next number in the sequence.

I tested it with a few more numbers and when I enter "7" it produces "13" and when I enter "6" it produces "8" and so on.

Code:
//Cameron Taylor
#include <stdio.h>
int main(){

[Code].....

View 2 Replies View Related

C++ :: Mortgage Calculator - Displaying Months In Correct Order

Mar 29, 2013

I need my code to display Month but it seems my code is skipping month's and not displaying 1, 2 3. It's going 1 , 3 ,5 and so on. This is the code i have for it

Code:
int month = 1;

And later on the code i have month++ That's my first mistake and i'm not sure how to possibly fix it. My second mistake is my Interest Paid output. This is the code i have for it

Code:
interestPaid = loanBalance*i;

This is on the while loop, but i'm not sure why it's not displaying the correct amount. It should display for month 1 = 500.00 , Month 2 = 498.28 and Month 3 = 496.55 and so on... However my code display's something close to it, but not that. i is my monthly interest rate. My code for it seems to be fine. If i can fix this two things i'll be able to finish the project. This is my entire code, how i can fix it so that my month is displayed in 1, 2, 3, etc.... and not 1, 3, 5, etc... And why my interest is not displaying what my professor has on his output screen (i provided the first three months on top in bold) If i can fix those things i'll have the rest. Here's my entire code

#include <iostream>
#include <iomanip>
using namespace std;
int main ( ) {
int month = 1;
// Holds the user's amount of loan.
double loanAmount;
// Holds the user's interest rate.
double i;

[Code] ....

View 3 Replies View Related

Visual C++ :: Circular Buffer - No Instance Of Overload Function Matches Argument List

Nov 25, 2014

I'm having some issues with my code. For the produce function i am getting an error saying 'no instance of overload function produce() matches the argument list' and also for the lines buffer[head].data = message; buffer[head].time = current_time i get an error saying 'expression must have pointer to object type.

In the code i'm not sure if i passed the variables to the function correctly. I have attached the code .....

code produce.txt

View 14 Replies View Related

C++ :: Number Sorting Program - Getting Correct Numbers

May 10, 2014

I am a beginner at C++, the output is pretty self explanatory. I'm trying to make a number sorting program with other features, but the numbers are all wrong.

Code:
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;

[Code] .....

Input.DAT
Code:
376 389 450 735 600 576 612 700 450 628 778 389 667 500 475 550 687 791 829 344
549 476 400 587 535 657 789 583 340 764 422 826 566 436 565 834 533 423 837 701
847 521 746 356 582 465 493 593 425 421

I can't for the life of me figure out why the numbers are all messed up.

View 5 Replies View Related

C++ :: Don't Give Correct Location Of Max / Min Number In Array

Nov 8, 2013

All my code is good, except the functions: findMacLoc and findMinLoc .They don't give me the correct array location of the max/min number in the array.I know is something simple I need to tweak in those two functions.

#include <iostream>
#include <time.h>
using namespace std;
void printArray(int a [], int & size)
{
int i;
for (i = 0; i < size; i++)
cout << a[i] << " ";

[code].....

View 2 Replies View Related

C :: Euler Project - Number Letter Counts

Apr 30, 2013

I am working on Euler Project exercise number 17. Here is the problem from the website.

"If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?"

Code:
#include <stdio.h>
#include <string.h>
#define LENGTHOFHUNDRED 7
#define LENGTHOFONETHOUSAND 11
#define NUMSTART 1
#define NUMEND 1000

[Code] .....

View 8 Replies View Related

C++ :: ATM Project - Get Withdrawal Of Money And Show Number Of Note

Feb 8, 2014

I have been given to do a simple ATM project which is containing of getting a number of notes in the ATM (100, 500, 1000). Get the withdrawal of money and show the number of note. Here what i got so far. I may need to use a loop but I am not sure how to put it into this.

#include <stdio.h>
#include <conio.h>
int main() {
int a=10, b=10, c=10;
int q;

[Code] ....

But the problem is i don't know how to make the code continue with the process with the amount of notes that is left from the previous input. The program will just stop but i really want it to be able to input new withdrawal amount so that it can decrease the note each time i withdrawal the money.

View 1 Replies View Related

C/C++ :: Bank Management Project - 6 Digit Account Number

Mar 1, 2015

I am trying to figure out the best way to approach a part of a project I am working on for school. I need to put in a 6 digit account number that will not allow duplicates for another user. How to approach this .

View 1 Replies View Related

Visual C++ :: What Is The Correct Behavior Of List Control

Aug 29, 2014

There is a list control in Windows.

When I create a list control I can assign an image list to it with the ListView_SetImageList().

By default, when just created there is no image list assigned as can be checked with ListView_GetImageList().

Now, what should happen when I do following call:

Create list control.
Create an image list
Get the current image list
Assign an image list to list control
Display some items
Assign an old image list to list control.

Does strings on the list control should be indented?

View 4 Replies View Related

Visual C++ :: Use Of IHTMLDocument2 In ATL Project

Sep 14, 2012

I have a toolbar created in VC++ 6.0 using ATL Project libraries! I need to use IHTMLDocument2 library in my toolbar project can i use it ? if yes then how ?

View 1 Replies View Related

Visual C++ :: Find Correct Font (height) For Text?

Mar 20, 2014

my problem:I have a text (singleline) and a fix width for the whole text.

How do I find the correct font (height) for this text?

View 8 Replies View Related

Visual C++ :: How To Convert DLL Project To MFC Extension

Oct 5, 2012

If I drop this regular dll project and create a new MFC extension dll project, it will involve too much work. I wonder if there is relatively easier way to convert an existing regular dll project to a MFC extension dll project? BTW, how can I tell a MFC extension dll project from a regular dll project?

View 1 Replies View Related

Visual C++ :: Create X64 QT Project By Default?

Mar 1, 2014

I compiled the source code of QT5.1 to work with Visual Studio 2010.

But it always start off with a win32 project, so that I need to change the settings every time.

How do I kick start with a x64 project by default?

View 1 Replies View Related

Visual C++ :: How To Make Icon For MSVC Project

Oct 22, 2013

I'm developing a software for Windows using MSVC 2010. My employer sent me 2 png files: 16x16 and 32x32 for the icons.

What I would like to do is to use them as a MSVC icon resource and don't use any code hacks. In the past all I had was an ico file and I just included it in the resource (rc) file for Visual Studio and that was it.

Now my question is: how do I make one ico file out of those 2 png files that will be accepted by MSVC? Is there a tool (preferably free) for it or some online service?

View 3 Replies View Related

Visual C++ :: Cannot Compile Wizard Generated Project

Jan 8, 2015

I'm using visual studio 2010

I run visual studio and choose File->New->Project->Visual C++->MFC->MFC Application

and Follow the wizard, select a dialog based app, then use all default options.

and trying choose Build -> Rebuild Solution.

than I've got error message like below.

>------ Rebuild All started: Project: Orcasetest4, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'Orcasetest4', configuration 'Debug|Win32'
1>Compiling...
1>stdafx.cpp

[Code] ......

What did i wrong? is Visual studio 9.0 Visual studio 2008?

I tried compile in mode x64 than it works. but in Win32 it goes errors.

View 2 Replies View Related

Visual C++ :: Project Link Error Not Added Lib

Mar 31, 2015

I have a VC solution . This solution contain 1 execute project and 10 library projects. The libraries added to the execute project by

#pragma comment(lib,"../outputbin64/lib/mylib").

When i comment these lines to not be added these libraries to the execute project , i will have link error like this :

LINK : fatal error LNK1104: cannot open file '../outputbin64/lib/mylib.lib'

My library projects not added to execute project with another way.

My question is why the execute project will link the libraries that not added to project programmatically?

View 7 Replies View Related

Visual C++ :: Using CDHtmlDialog In MFC Dialog Based Project

Aug 30, 2013

I am trying to use CDHtmlDialog in a MFC dialog based project.

What i want to achieve is pretty sample. Have one image, one button and one text box in the HTML page.

And then dynamically change this based on a timer. i.e., there're multiple images in the folder and it will change every seconds. Once the button is clicked, the timer stops and no more image changes. Same time when image changes the text in the text box also should change.

I know this is pretty simple, but for some reason i am not able to make the image even display in the dialog.

I am using Visual Studio 2012 in Windows 7 machine.

View 4 Replies View Related

Visual C++ :: User Input In Two Arrays - Comparison Always Show Zero Correct Answers

Nov 3, 2012

The following program takes user input into two arrays and should then determine how many items are different by comparing them with a loop. The comparison always show zero correct answers.

#include <iostream>
using namespace std;
const int QUESTION = 20;
//class for testing grades
class TestGrader {

[Code] ....

View 4 Replies View Related

Visual C++ :: Displaying JPEG Image

Mar 20, 2014

Which command should i use for displaying a jpeg image in Visual Studio 2008 (VC++)?In the past i used LoadImage function for displaying Bitmaps.

View 14 Replies View Related

Visual C++ :: Cout Is Not Displaying Text?

Apr 13, 2013

I'm making a very first program. It's very little more then a simplistic calculator, but i'm having a problem with the cout function. It won't display any text what could the reasons be?

#include <iostream>
#include <string>
#include <sstream>
using namespacestd;
int main () {
do {
int(a);

[Code]...

Oh and i'm aware it's still riddled with numerous problems, I just have been working on the cout thing first.

View 3 Replies View Related

Visual C++ :: If Else Statement Displaying Both Options

Oct 21, 2013

I am new to coding and have a question with my if else statement. This is a VERY simple program that I have made something like in Javascript before, but when I do it in C++ it does not work correctly. It displays both the options. Here is my code.

// Practice.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
// Asking for a number {
int x;

[Code] ....

View 14 Replies View Related

Visual C++ :: Compile Time Errors For OpensSSL In Project

Feb 4, 2014

I am trying to build a VC++ project in Visual Studio 2010. [URL] ....

This project has a dependency on openssl libraries. How can I successfully build this project? How to add third party libs/dlls in a project.

View 1 Replies View Related

Visual C++ :: Creating Code Analyzer Tool For Project?

Sep 10, 2013

I am creating an application which will work as a static code analyzer after compiling my code in VS 2008 for VC++ projects. It will be a kind of code review.

how and where do I need to put my custom rule sets, and what should I do to create such a application.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved