C++ :: Code Compiles Successfully Yet Previous Day Is Blank

Feb 17, 2013

//#include "stdafx.h"
#include<iostream>
#include<cmath>

using namespace std;
//class declaration
class dayType{
public: int presday;

[Code] ....

So everything works perfectly, well not everything lol. Code compiles successfully without any errors but previous day does not calculate. In a sense that when it asks for number of previous days it returns a blank statement.

For example: Previous number day is: shows nothing

View 2 Replies


ADVERTISEMENT

C++ :: Program Compiles Successfully But Calculations Give Wrong Answer

Feb 11, 2013

I'm using MSVC++ and it builds sucessfully but somewhere something is obviously messed it. Once i try to debug it just shows weird numbers.

int k=0; //could this be the problem??? since 0 would be over writing any given value. but if i leave int k; it showsa warning and MSVC would count that as an error

#include "stdafx.h" //Header file section
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//structure declaration
struct menuitemtype

[Code] ......

View 14 Replies View Related

C# :: Unable To Send Event Successfully

Jan 12, 2015

In my MainWindow I have a UserControl called CamAccessLevel1. This will be one of a few different UserControls which will have more and more functionality to a device as the Level goes up.

Each of those functionalities are themselves a UserControl, so that I don't have to keep remaking them for each different "Level" that I make.

So... I have a UserControl in a UserControl in my Mainwindow. My first goal is to have a button in one of those sections send an event back to the MainWindow to close the application. This sections is called "ProgramControl", as it has functions that relate to the program itself.

I can't seem to set a datacontext within another datacontext -> There is an error in UIViewModel below...

Note that I have replaced my company name with [snip]

In my Mainwindow.xaml
<views:CamAccessLevel1 x:Name="UserInterface"/>
Mainwindow.xaml.cs
public partial class MainWindow : Window {
#region MyModel

[code]....

View 10 Replies View Related

C++ :: Program Compiles But Doesn't Run

Apr 28, 2013

My program compiles but doesn't run, Here is the screen shot of debugging

//DynBag.cpp : Implementation File
#include <stdexcept>
#include <iostream>
#include "DynBag.h"

[Code] .....

View 3 Replies View Related

C++ :: Guessing Game - How To Successfully Loop Back To The Beginning

Feb 5, 2015

So I'm making my first program w/ C++ and its a game guessing game. I've learned how to use booleans, chars, strings, if/else, loops, and input. Anything past that I dont know. I've gotten my game to work properly except for the fact that when you guess incorrectly, the program closes. I want the program to go to the beginning of the program again so the user can restart. So far i've gotten the loop to beginning thing to work but not well. It'll only repeat twice before closing again and it'll say the user got the wrong answer even if it was correct. Here's my code

#include <iostream>
#include <string>
#include <random>
#include<ctime>
using namespace std;

int game(){
string playerName;
int guess;

[Code] ....

View 1 Replies View Related

C Sharp :: Unable To Successfully Submit List Of Authors From Listbox

Jan 17, 2014

I need to add either one author or a list or array of authors to my sql table. Here is the code that is used to insert the authors into the table:

The code from the listbox:

<asp:ListBox runat="server" ID="AuthorList" DataTextField="AuthorName" 
            DataValueField="AuthorName" DataSourceID="Authors"  SelectionMode="Multiple"/>    

Datasource code:

<asp:ObjectDataSource runat="server" ID="ds_InventoriedAuthors" 
SelectMethod="GetAuthors" TypeName="CntyLibrary.Inventory.Authors" InsertMethod="AddAuthors">
    <InsertParameters>
        <asp:QueryStringParameter Name="AuthorID" Type="Int32" QueryStringField="id" />

[Code] ....

View 3 Replies View Related

C++ :: Program Compiles / Runs But Closes Right Away When Finished

Oct 15, 2013

Program compiles and runs no problem but closes right away when finished.

Heres the code:
Code: #include <iostream>
#include <cmath>
using namespace std;
double calcDistance(double,double, double, double);
float calcKilometers(float, const float) ;

[Code] ....

View 3 Replies View Related

C :: Program Compiles Fine But Seg Faults While Running

Dec 1, 2013

So i compile fine, but when i run my program, after the printf it just segfaults (core dumped)...

Code:
#include<stdio.h>#include<string.h>
#include<stdlib.h>
void main() {
unsigned int j=0, max=9;
char num[100] , str1[100], str2[max];
FILE *fp;

[Code] .....

View 4 Replies View Related

C++ :: Program Compiles But Refuses To Print Out Char Grades?

Nov 10, 2014

#include <fstream>
#include <ostream>
#include <iostream>
#include <iomanip>

using namespace std;

const int NAMESIZE = 15;
const int MAXRECORDS = 50;

[Code] ....

View 2 Replies View Related

C :: How To Print Another Shape Near Previous One

Nov 9, 2014

How do i print another shape near the one i did. I have this code but how i can put another shape near it like this

Code:
#include <stdio.h>
int main() {
int i;
for (i = 0; i < 5; i++)
switch (i) {
case 0:
printf(" *

[Code] .....

View 7 Replies View Related

C++ :: Add Go Back To Previous Menu

Oct 23, 2014

Here is a simplified version of my Menu class, where submenus can be inserted arbitrarily deep. I need to add a new functionality "go back to previous menu", which I would like to be activated by entering 0 (universal command for all Menu instances). I considered the Memento Pattern, but that doesn't seem to quite fit. add that functionality to my Menu class.

#include <iostream>
#include <cstring>
using namespace std;
const int END = -1, NO_SUBMENU = 0;

[code]....

View 3 Replies View Related

C# :: Detecting Previous Installs?

Jul 16, 2014

Say a user installs and uses the software for awhile. Then they uninstall it. Client wants the database containing client data to remain behind, in case they ever re-install the software. Which is fine.

So then.. they re-install the software. Client wants them to have the choice to either use the existing database, or to create a new one. When the software fires up, it always checks for the database, and creates one if it's not there. So how can I determine if the instance is a new install, or a current install, given that the database will be there no matter what?

View 7 Replies View Related

C/C++ :: How To Add Numbers From Previous Rounds

Dec 13, 2014

I am in the process of creating a game that has two players machine and person. The player is selected randomly each round. So if the player is selected, he needs to choose a number from 1-9. Then the machine needs to choose another new number either in the same row or colunm.(i figured out how to check against col.and row). Then keep going until someone reaches 31.

I'm stuck on how to add the numbers from previous rounds and have them reflect in the new rounds. While at the same time using the last entered number(last numbers) as a reference has to whether or not the new number is valid.

Ok I created a while loop as suggested. But it is not adding each round like it should. So the question is: What is wrong with the code after the while loop?

while ((x != 0) && (suma < Meta)){
cout << "SUM =" << x + last number << endl;
if (player == Person) {
x = machinerandomnDigit(last number);
sum = sum + x;
player = Person;
last number = x;

[Code]...

View 5 Replies View Related

C# :: How To Add Number To Previous To Get Total

Feb 7, 2015

decTotalAmountOwed = decAmountOwed + decAmountOwed;

This is what i've tried so far. The numbers are supposed to be added together once placed in listbox.

View 8 Replies View Related

C++ :: Execute The Previous Statements After Else Statement?

Mar 10, 2013

I have a condition and I would like to instead change the condition so that it would execute the previous statements after else statement.

It seems hard to explain but I'll try my best to illustrate anyway

if (condition)
<statement1>
else
<statement2>

So I would like to change the condition so that

if (condition)
<statement2>
else
<statement1>
And the condition is
Code:
if(!lightStateAtNextLink || !bIsLightEnAtConnection && nLinkNext.IndexToAttachedNode() != pVeh->_.stAutopilot.m_dwNextNode || bIsLightEnAtConnection && nLinkNext.IndexToAttachedNode() == pVeh->_.stAutopilot.m_dwNextNode)

And I have changed that to this. Is this correct?

Code: if(lightStateAtNextLink && bIsLightEnAtConnection || nLinkNext.IndexToAttachedNode() == pVeh->_.stAutopilot.m_dwNextNode && !bIsLightEnAtConnection || nLinkNext.IndexToAttachedNode() != pVeh->_.stAutopilot.m_dwNextNode)

View 5 Replies View Related

C :: Array With Only Zeros - Add Value To All Of Previous Values

Apr 17, 2013

For my assignment I have to have an array with only zeros.

Code:
int a[20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; Then I need to send it into a function that makes the array like this

Code: int a[20] = {0,1,2,3,4,5,6, ... , 19}

Which I have done here

Code:
int initialize(int a[], int n) {
int m = 0;
int i;
printf("

[Code] ....

Now I need to do the following with the array. I need to take whatever value is in each position and add that value to all of the previous values. like this.

Code:
a[3] = a[3] + a[2] + a[1] + a[0]

only for every a[i] I know that I can code this the long way, but I just can't see to be able to find out how to do this a better way.

View 1 Replies View Related

C/C++ :: Timer Will Start From Its Previous Value Instead Of Its Initial Value?

May 8, 2014

I am making a product and in which i use a timer. I want when the product is being start the timer will run and when the product is off the timer will stop. If i again start the product the timer will start from its previous value.

I have problem that the timer start from its initial when i start my product.

View 7 Replies View Related

C++ :: Summation Of Numbers In Current And Previous Iterator

Jul 9, 2012

Below is the sample of the code :

int summation = 0;
for (it= s.begin(); it!= s.end(); ++it) {
summation += std::atoi( ((*it).substr( 8 )).c_str() );
}

Nos after the first 8 characters are the ones I need to perform addition on.

do the summation of these nos.

View 14 Replies View Related

C# :: Small Program That Will Create Multiples Of The Previous Line?

Apr 4, 2015

Im trying to do a small program that will create multiples of the previous line *2, and spit out the anwser in seperate lines (as many times as the user wants)

Example if i wrote it in a bad way

2
4
8
16
32
etc.

At this time my code looks likes this, now im planing to get my hands on the IF statment

using System;
using System.Collections.Generic;
using System.Linq;

[Code].....

View 6 Replies View Related

C++ :: Text Game - How To Make Player Go Back To Previous Location

Mar 19, 2013

I have started making a text adventure game.

if (Choice == 2) {
cout << "" << endl << "You follow the light to the end of the hallway, you find your self in a room" << endl
<< "with natural light coming from a hole in the ceiling." << endl << "" << endl << "You hear the door you just came through, slam behind you!" << endl << "" << endl
<< "There are three possible directions." << endl << "" << endl << "Do you:" << endl << "" << endl << "1) Go forward" << endl << "" << endl << "2) Go left" << endl

[Code] .....

Ignore the if (Choice == 2) at the beginning, that's linked to some previous code.

I want to make the player go back to the first bit of text but i'm not sure how to do this if they keep choosing to go back and forth from one location.

I first thought of doing it by just putting the text back in after they have chosen the option, but I can't do this infinite times.

View 5 Replies View Related

C++ :: Zlib Outputting Blank File?

Oct 30, 2014

I wrote a program to compress a file with gzip, which works fine. I also wrote a program to decompress the gzip file, which runs but outputs a blank file.

Code:

main.cpp:
#include "decompress.h"
int main(int argc, const char * argv[]) {
if(argc == 3) {
decompressor(argv[1], argv[2]);

[code].....

View 4 Replies View Related

C++ :: Draw 2D Grid With Blank Cells?

Mar 21, 2014

I am trying to draw a 2d grid array for a battleships game. I need the grid to have a border around each cell, how to do this. so far my code is:

#include<iostream>
using namespace std;
int main(){
int grid[5][5] = {{0}};

[Code] .....

View 4 Replies View Related

C++ :: Keep Looping Until User Enters A Blank Line?

Aug 4, 2013

My goal is to create a loop that keeps taking user input over and over until the user doesn't enter anything into 'cin >>', leaves the line blank, and simply presses the ENTER key to move on, at which point the program is supposed to break out of the loop and continue on with the rest of program execution. Something like this:

Code:
do {
cout << "
Enter a name: ";
cin >> input1;
if (input1.empty())

[Code] ....

As you can see, I've already tried using the empty() function, but that didn't work, the program simply stays in the loop and doesn't break out, no matter how many times I press enter. It just keeps prompting me to enter a name. I've also tried using something like

Code: if (input1 == "")

but that doesnt work either. How do I break out of this loop?

View 2 Replies View Related

C++ ::  No Compile Errors But Blank Screen On Execute?

Oct 23, 2013

I'm working on a Hash Table implementation and after fixing all the errors and finally getting it to compile and link correctly, I am met with a black screen upon execute.

main.cpp
#include <stdio.h>
#include <string.h>

[Code]....

I tried inserting a debug statement in the main() function to see, and it wouldn't even print out the message "debug me" on the screen.

I am using Code::Blocks on Windows with the mingw32-g++.exe compiler. Here is my build log:

mingw32-g++.exe -Wall -g -c D:MediaDesktopHashElement.cpp -o objDebugElement.o
mingw32-g++.exe -Wall -g -c D:MediaDesktopHashHashTab.cpp -o objDebugHashTab.o
mingw32-g++.exe -Wall -g -c D:MediaDesktopHashmain.cpp -o objDebugmain.o
mingw32-g++.exe -Wall -g -c D:MediaDesktopHashStudent.cpp -o objDebugStudent.o
mingw32-g++.exe -o binDebugHash.exe objDebugElement.o
objDebugHashTab.o objDebugmain.o objDebugStudent.o -mwindows
Output size is 1.06 MB
Process terminated with status 0 (0 minutes, 2 seconds)
0 errors, 0 warnings (0 minutes, 2 seconds)

View 11 Replies View Related

C++ :: Keep Looping Until User Enters A Blank Line?

Aug 4, 2013

So I've run into the following problem. My goal is to create a loop that keeps taking user input over and over until the user doesn't enter anything into 'cin >>', leaves the line blank, and simply presses the ENTER key to move on, at which point the program is supposed to break out of the loop and continue on with the rest of program execution. Something like this:

do {
cout << "
Enter a name: ";
cin >> input1;
if (input1.empty()) {

[Code] .....

As you can see, I've already tried using the empty() function, but that didn't work, the program simply stays in the loop and doesn't break out, no matter how many times I press enter. It just keeps prompting me to enter a name. I've also tried using something like

if (input1 == "")

but that doesn't work either. How do I break out of this loop?

View 1 Replies View Related

C# :: User Control Being Blank On Main Window

Jan 5, 2015

I have followed the tutorial here - [URL] .....

This is a tutorial that I have gone through completely with success, but now I am trying to create a different project using the same sort of setup.

When I add my usercontrol to the MainWindow it has none of the buttons/TextBlocks on which I have put on the UserControls - It is just a blank box. What could be causing this?

I have changed the name of the project to [snip] because it has a company name in it...

"NumericControl.xaml"
<UserControl x:Class="[snip].UserControl.View.NumericControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

[Code] ....

View 14 Replies View Related







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