C++ :: Do While Statement Doesn't Work

Nov 21, 2013

#include <iostream>
#include <string>
using namespace std ;
int main() {
string bored ;
do {
cout << " program" <<endl ;

[Code] .....

I made this as a simple do/while program, and if i run it, the second do/while statement will keep on going forever, without the [cin >> bored;] line working?

View 2 Replies


ADVERTISEMENT

C :: Calendar Doesn't Work

Sep 24, 2013

I just dont see what the issue is here. I have stared at this thing forever. Im trying to make a calendar from scratch so I can be prepared for my second test on Friday.

Code:
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int i, n, s;

[Code]....

View 10 Replies View Related

C++ :: QuickSort Code Doesn't Work

Jun 9, 2014

I've implemented it a bit differently: I create 2 temporary arrays, one for the numbers lower from the pivot , an done for numbers greater then the pivot. in the end of each iteration the 2 arrays are copied to the original array:

Code: #include <iostream>
void QuickSort (int* A , int start, int end){
if (end-start<3){
return;
}
int mid=(start+end)/2;
int pivot=A[mid];
int lA[end-start] , rA[end-start], rCounter=0,lCounter=0;
int curr=0,i=start;

[code]....

View 3 Replies View Related

C++ :: Application Release Doesn't Work On Other PC

Dec 9, 2013

I am trying to release my C++ app to run on desktops that dont have VS installed and have created an install shield app to install on the desired computer. my issue is even after packaging it, it still requires certain DLL's...I read online that I had to copy 'msvcr120.dll' and a few others to syswow64 and sys32 folders but now when I try run my app it just crashes before starting.

I think it sucks that Microsoft no longer packages required DLL's like it used to in 2010.

View 1 Replies View Related

C/C++ :: Code For Bin File Doesn't Work

May 14, 2014

Ive been having a hard time creating bin file. Whenever I append data, the data wont show in browse function. And this program works good without the bin file code.

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>

[Code]....

View 2 Replies View Related

C++ :: Text For Score And Difficulty Doesn't Seem To Work

Sep 28, 2013

my text for the score and difficulty doesn't seem to work. They are both appearing twice and not updating. The score text worked fine until I inserted the difficulty text and I can't seem to find the problem. URL.....

#include "stdafx.h"
#include <iostream>
#include <sstream>
#include <SFML/Graphics.hpp>
int main()
{
sf::ContextSettings settings;
//settings.antialiasingLevel = 8;

[code]....

View 2 Replies View Related

C/C++ :: String Copy Into Struct Doesn't Work

Nov 1, 2012

i'm right now using C, IO is done via ncurses, but that won't affect the following problem, i think. The relevant code is:

#define SIDEBARWIDTH 27
//...
typedef struct {

[Code]...

surprisingly this works, now the new 3rd outputline is correct again. So it seems that the printcommand has some troubles with accessing the struct here. Not sure if that might be ncurses fault. Still feels odd.

View 2 Replies View Related

C++ :: Increase Char Code Doesn't Work

Jun 11, 2014

Code:

#include <iostream>
using namespace std;
int main () {
char character = 'a';

[Code] .....

the point of this code is to increase character by 1 (so from a to b in this case).

The line highligted in red is the line that the system is rejecting at the moment (but there may be other issues). why it is invalid?

View 5 Replies View Related

C :: Laser Project Tile Engine Doesn't Work

Aug 27, 2013

I should reduce the number of bitmaps I used in my code. I translated my particle engine into code that could be compiled as plain standard C

Currently, the code has a segmentation fault somewhere that I can't figure out. How it should function is that it takes orders from a queue for new lasers to store the instances in a linked list. It then takes that data and updates its coordinates, one node at a time. The first node should also be the first node to complete its life, so it gets removed, and the list is set to the next node in memory. If there are no more nodes left, a if-statement should catch it and either break the current loop, or wait for more items to be requested. If there are nodes left, the process will continue to remove the first node in the list until there are none left. Obviously this is not quite how it works. When I tested in once in SDL, the laser would update every 5 frames, but wasn't shown constantly, and would crash after the node was to be disposed of. When I initialize with the SDL parachute, it would exit before I event saw the screen. Also, the code I translated to standard C will display that the laser has been updated to the screen, but it never says that it has moved up. It crashes after about 4 printf() statments execute. My debugger has been giving me mixed SIGTRAPS, and "nothing is wrong" output. Here is the code in standard C:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MAX_LASER_QUEUE 10
}

[code]....

View 6 Replies View Related

C++ :: Fstream Doesn't Work In Combination With Linked Lists

Jan 1, 2014

Im about to program a RPG and, of course, the player has got an inventory. The items in this inventory are stored in a linked list and have IDs in form of strings.

player.cpp: (just the most relevant)

#include <list>
#include <string>
using namespace std;

[Code] ....

Of course, when the player saves the game, the inventory has to be saved too.

game.cpp(just the m. R.)
#include <fstream>
using namespace std;
class CGame{

[Code] .....

Now, in my code I write the linked list into the file savegames.sav

void CGame::save(CPlayer* player){
m_out.open("savegames.sav", ios::out);
m_out.write((char* ) &player->m_inventory, sizeof(player->m_inventory));
m_out.close();
}

In another function i load the list:

void CGame::load(CPlayer* player){
m_in.open("savegames.sav", ios::in);
m_in.read((char* ) player->m_inventory, sizeof(player->m_inventory));
m_in.read();
}

And when i access the loaded linked list with the .empty() function or so, Windows says the following:

<Mygame.exe> funktioniert nicht mehr (in English: doesnt run anymore).

I tried so much to fix that but i dint reach my aim.

View 2 Replies View Related

C++ :: Matrix Class - Template Constructor Doesn't Work So Well

Feb 5, 2013

I realized a Matrix class to practice and I have a problem I can not solve! Here my problematic code:

Mtrx.h:

Code:
template <class T>
Mtrx::Mtrx(dim m, dim n, const bool random_constructed = false, const T min = static_cast<T>(0), const T max = static_cast<T> (10))
Mtrx.C

[Code] ...

And here the relative main section:

Code:
Mtrx rand1 ( 5, 5, bool);// ok
cout<<rand1<<endl;

Mtrx rand2 ( 7, 3, bool, -5, 20);// ok
cout<<rand2<<endl;

Mtrx rand3 ( 7, 7, bool, 0., 15.);// compilation error: undefined reference to
// "Mtrx::Mtrx<double>(unsigned long, unsigned, bool, double, double)"
// collect2: error: ld returned 1 exit status

I compiled in a Linux OS with g++ -std=c++11

View 3 Replies View Related

C++ :: Function To Count Digits Of Entered Number Doesn't Work

Feb 19, 2013

I wrote a program with function my own function which count the digits of entered number. The problem is whatever i type it shows 0 digits.Why is that?

Code:
#include <iostream>
using namespace std;
int cikCipari (int skaitlis, int cipars);
int main()

[Code] .....

View 7 Replies View Related

C++ :: Program That Asks User For Numbers And Adds Odd Ones Doesn't Work

Nov 12, 2014

Title is self-explanatory.

Code:
#include <iostream>
using namespace std;
int main ( ) {
float number;
float sum;
float divi;
while(number != -1) {

[Code] .....

View 5 Replies View Related

Visual C++ :: Fill Color In Shapes Using FLTK Doesn't Work For Circles

Aug 28, 2014

I installed FLTK 1.3.X from [URL] on my visual studio 2012 compiler and use PPP book for C++ programming [URL]. My problem is about filling a Shape in.

Code:
#include <Simple_window.h>
using namespace Graph_lib;
int main() {
Simple_window win(Point(100,100), 1000, 600, "Binary_tree");
Graph_lib::Circle c(Point(200,200),50);
c.set_color(Color::red);

[code]....

When I run the program, All three Shapes are drawn on window but only the Rectangle is filled in! Why? set_color works for the three and apparently the set_fill_color is defined for all Shapes and it too should work but why it doesn't for Circle and Ellipse?

This [URL] is the .CPP and .h files ( )

View 6 Replies View Related

C/C++ :: How To Make Switch Statement Work

Feb 26, 2014

The program i am trying to make is for practice of using switch. the idea is the user enters a number and the program will print a day of the week corresponding to said number.

the statement is not complete with all cases yet, but i dont want to write all of it until i am sure of it being correct.

errors when compiling (gcc) are as follows

1 warning and 3 errors generated.
Robins-MacBook-Air:array2 RDenton$ gcc array2.c
array2.c:26:9: warning: format string is not a string literal
(potentially insecure) [-Wformat-security]
printf(a[uservalue]);

[code]....

View 3 Replies View Related

C++ :: Return By Reference - Statement Doesn't Return Value Of N

Jan 11, 2015

From the page: [URL] ....

#include <iostream>
using namespace std;
int n;
int& test();

[Code] ....

Explanation

In program above, the return type of function test() is int&. Hence this function returns by reference. The return statement is return n; but unlike return by value. This statement doesn't return value of n, instead it returns variable n itself.

Then the variable n is assigned to the left side of code test() = 5; and value of n is displayed.

I don't quite understand the bold sentence. Shouldn't value of n and variable n be the same?

View 8 Replies View Related

C++ :: Transfer If-else Statement Into Switch Statement?

Sep 7, 2013

How to make if else code below into SWITCH STATEMENT?

cout << "Enter the temperature: ";
cin >> temp;
cout << "Enter the pressure: ";
cin >> pressure;
cout <<endl;

[Code]....

View 6 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 :: Array Doesn't Seem To Be Working

May 26, 2013

I am writing a program that expands array list whenever they get too full...so far i have this:

Code:

#define DEFAULT 10
typedef struct ArrayList {
//array of strings
char **array;

[code]....

So, ArrayList *myList should return a pointer to the new arraylist or null if malloc fails. what exactly I need to set my maximum to, I know that it shouldn't be 0 and array[i] doesn't seem to be working either. I also am not sure if I am properly setting up null correctly for my array.

View 1 Replies View Related

C/C++ :: Stringstream Doesn't Pass Its Value Along

Dec 21, 2014

I just wanna have a very simple function that reads values from a text file row by row. The first value is passed along from the stringstream to my float data[] but after that it doesn't pass along anything. The strange part (for me at least) is that the stringstream contains the values it should contain, but they doesn't wanna end up in data[].

main.cpp
#include <fstream>
#include <iostream>
#include <string>
#include <sstream>

[Code]....

View 4 Replies View Related

C :: Printf Doesn't Print On Screen

May 23, 2013

This code runs. However, when I run it, the text from printf doesn't appear until after I type in the two numbers.

I use Wascana, will it run correctly on other compilers?

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
fflush(stdout);

[Code].....

And this is how it turns out on the screen:

Code:

6
3

What size is the die:

how many dice to roll:

Numbers are 3d6
Rolling die no.1...
RolledDie: 4 DieTotal: 4
Rolling die no.2...
RolledDie: 5 DieTotal: 9
Rolling die no.3...
RolledDie: 5 DieTotal: 14

The total is: 14

View 4 Replies View Related

C++ :: New Project Doesn't Cout Any Values?

Apr 11, 2014

I'm trying to build a new project and i installed some new libraries in it but when i try to compile any code it doesn't give me any value just press any key to continue, i didn't make any files but one and even if i tried to do this simple task it doesn't cout any result:

#include<iostream>
using namespace std;
int main() {
cout <<("ha");
system("pause");
return 0;
}

View 4 Replies View Related

C++ :: Ifstream Doesn't Read From The File

Aug 14, 2014

I wrote a program which was supposed to decrypt a file encrypted with the XECryption algorithm. Now, I know the decryption algorithm, but I have a problem with my ifstream object. It doesn't read anything at all, and the ofstream object just outputs a single random byte in a never ending loop. I've tried using cin, which works correctly, but it's not what I want.

Here's the code:

#include <fstream>
#include <iostream>
using namespace std;
int main() {
ifstream in("file.in", ios::in);
if (!in.is_open())

[Code]....

I'm doing this on a Windows 8(.1) pc with Code::Blocks 13.12. In the file (file.in) I have replaced the points with spaces. What is wrong with the code?

View 9 Replies View Related

C/C++ :: Why Doesn't String In Vector Change Value

Apr 22, 2014

I am trying to change the value of of time in my vector of structs. The result should output 1430 as the value of shares[1].time though I get something different.

unsigned convTime = 1430;
std::stringstream out;
out << convTime;
shares[1].time = out.str();
std::cout << shares[1].time;

But my shares[1].time stays as its original value and not 1430.

View 1 Replies View Related

C++ :: Program Doesn't Alphabetize Strings

Jan 18, 2015

I can't seem to get my program to alphabetize a vector string. It displays the names, but not in a sorted order.

void sort_names(vector<string> &nameList) {
int i, minIndex;
string minValue;
int size;
size = nameList.size();

[Code] ....

View 4 Replies View Related

C# :: Array Doesn't Return Values

Jun 26, 2014

While working on another issue I started memory cleaning and refactoring. While refactoring I decided to create an array Resize Array Reize and Null Count:

Spoiler

public int NullCount(string[,] Original) {
try {
int returnInt =0;
for(int x =0; x<= Original.GetUpperBound(0);x++) {
if (Original[x,0]==null )
{returnInt++;}

[code]......

View 6 Replies View Related







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