C/C++ :: Snakes And Ladders Codeblocks Error
May 5, 2014
My error on code blocks is fatal error no such file found in iostream, I don't understand this error!!
#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>
#include <fstream>
#include <vector>
#include <sstream>
#include <iterator>
int Random(int random) {
return (rand() % random) + 1;
[Code] .....
View 7 Replies
ADVERTISEMENT
Feb 28, 2014
I have a problem with my code while trying to simulate a snakes and ladders program. The objective of the program is to simulate many games (100000+) to gain statistics:
1. The most likely number of rolls.
2. The mean value of the number of rolls.
3. The most common square, C, on which a token may come to rest. i.e. move on to.
4. The probability of coming to rest on square C.
5. The least likely square on which a token may come to rest and what is the probability of this occurring.
6. The distribution in the number of rolls needed per game presented as a normalised graph.
7. The minimum number of rolls of the die - called Nmin.
8. How many different paths (unique sequences of die rolls) take Nmin rolls to complete the game?
However my program (on Tenacious C) doesn't seem to run at all...
I have run it on internet compilers and other compilers but it must work on Tenacious C.
Below is the code I have at the moment, it works fine when stepped through or ran on a different compiler.
How to create code to answer the 8 points above. For instance, to get point number 2. I must find the total rolls divided by the total number of games, but am not sure how to do this.
Code:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define NUMBEROFGAMES 10
int GetThePositionOfMovement(int CurrentPosition, int dieValue);
[Code] .....
Attached image(s)
View 3 Replies
View Related
Mar 25, 2013
I am writing a snakes and ladder program and I'm almost finished, but I am struggling with the dice to work in the way I want it to work. I want the dice to work like this :
Before each player throw the dice they must start at 0.
Each player must throw a 6 on the dice to move on the board.
If a player threw a 6 on the dice, that player can throw again.
But I ended up with two seperate dice, one for each player (game is only for two players).And when I run the program, both players don't start at 0. And when I throw the dice, both players move at the same time but with different values.
If one of my players threw a 6, they just keep on throwing until someone wins the game. I tried to use a switch and if statements but I couldn't get it right. And so I did this :
Code:
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#define SpaceBar 32// 32 is an ASCII value for a spacebar
[Code] ....
View 5 Replies
View Related
Jan 24, 2014
I am trying to simulate a random dice roll as a basis for a chutes and ladders game
Code:
int main {
int i = 0, diceroll;
while (i>5) {
diceroll = 1+rand()%6;
i++;
}
return 0;
}
However the numbers get don't seem to be random, it always starts off with 6,6,5.. then its random.
View 10 Replies
View Related
Sep 28, 2014
I am trying to use Intel's Threading building blocks with Code::Blocks (On windows 7) I am really struggling with getting this to actually compile. It just throws various errors depending on what I try.
View 14 Replies
View Related
Aug 30, 2013
how to use SDL just today, installed the standard SDL library on the compiler. But when i got to the point where I needed to install the SDL image extension library I thought I had everything correct but when I tried running a program using it I got errors. The non-extension SDL apps work just fine but when I try using SDL_image functions in my code I get problems, although when I begin typing the function the name shows up and i do not get issues with the .h, I feel its a link issue because I get errors such as:
ld.exe||cannot find -lSDL_image|
ld.exe||cannot find -lSDL_image|
||=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===|
I'm confident I have my /includes installed correctly. Also I was unable to find the 1.2 version for the Img extension so i reluctantly went ahead with 2.0 if that is perhaps causing issues.
View 1 Replies
View Related
Oct 23, 2014
I'm using Codeblocks 13.12 in Windows. I want to compile and run c++ files with the console inputs are automatically extracted from a file. More importantly, I do not want to change the code to read files. I just have written codes to read them from the console. Any change in settings?
View 3 Replies
View Related
Jul 3, 2012
I've recently started to learn C++ and I'm using codeblocks as my IDE, but I keep getting problems with AVG free edition picking up random pieces of code as Trojans ?! I've put an example of some code that sets it off below, and the error message I get. Is there anyway I can set AVG not to trigger with any codeblocks coding I've done? I guess I could tell AVG not to trigger for that folder, if that's even possible?
Code:
#include <iostream>
using namespace std;
class MyClass{
public:
void coolSaying(){
cout << "BUST A MOVE!!" << endl;
[Code] ....
Error I get:
File name: h:DesktopC++ projectsclasses and objects 1 inDebugclasses and projects 1.exe
Threat name: Trojan horse Agent3.BMSZ
Detected on open.
View 14 Replies
View Related
Oct 18, 2013
I upgraded to code::blocks and now I have the errors while trying to install sfml and sdl (to use in a dual project): Codeblocks libs:Permission Denied
Codeblocks libs is a custom folder I created and copied libs from the lib folders to because I got the same errors in the actual folders and thought it might be because of their location. What should I do?
View 19 Replies
View Related
Nov 26, 2014
The user will be allowed to pick:
-the number of problems they want to do
-the type of problem (addition, subtraction, multiplication, division)
-the range of numbers for the problems (like 0 to 9, -100 to 100, etc.) [random numbers in the range]
Your program will then display the given number of problems and get the answer from the user. It will tell the user it they are correct or not. If they are incorrect, it will print the correct answer.
After the given number of problems are displayed, the program will give the user the final number correct and percentage correct. The user will be asked if they want to go again. If so, you will reprompt the user for all the information and run again.
I came up with code thinking I was going in the right direction but it doesn't work correctly at all. We have to use functions. My main issue is how do i call variables from another function so all of the functions work together. I repeat I don't understand parameters and calling functions. here's the code:
#include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;
int get_user_range(int &x, int &y);
int get_random_number ();
[Code]......
View 1 Replies
View Related
Sep 8, 2014
Cannot manage to find the error source when i try running the program, the first part of the program runs just fine its when i try to get the temperature one that i get the error
#include <iostream>
#define pi 3.141592
using namespace std;
int main() {
double r, h; //declare variables for radious and height
double Surfacearea;
[code]....
View 1 Replies
View Related
Apr 3, 2013
I've just recently started to learn C++, and I'm encountering some errors I can't seem to figure out.
InventoryItem.h:
Code:
#pragma once
class InventoryItem {
public:
InventoryItem(string name, int amount);
~InventoryItem(void);
string getName(void);
int getAmount(void);
[code].....
Errors:
Code:
1>d:c++consoleapplicationconsoleapplicationinventoryitem.h(6): error C2061: syntax error : identifier 'string'
1>d:c++consoleapplicationconsoleapplicationinventoryitem.h(8): error C2146: syntax error : missing ';' before identifier 'getName'
[Code] .....
View 14 Replies
View Related
Jan 6, 2015
I am trying to make a program like a virtual machine, and therefore I need to have a virtual hard drive. I have it split across four files, each being exactly 67,108,864 bytes (at this point, the files consist of 0x00 throughout the entire file). When I try to write to the beginning of one of the files, I get a "EXC_BAD_ACCESS (code=1, address=0xff)" from Xcode.
Here is my source code.
Code: #include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream drive1("main1.vhd", ios::in | ios::out | ios::binary);
fstream drive2("main2.vhd", ios::in | ios::out | ios::binary);
fstream drive3("main3.vhd", ios::in | ios::out | ios::binary);
fstream drive4("main4.vhd", ios::in | ios::out | ios::binary);
[code]....
View 4 Replies
View Related
May 4, 2014
Using a template in the assignment, I don't know what I did wrong?
Code:
#include <iostream>
#include <string>
using namespace std;
template<class T>
void mpgcalc(T& Miles, T& Gallons)
[Code] .....
View 2 Replies
View Related
Jun 13, 2013
Q. Consider the following C declaration.
int x[10], y,z;
What kind of error does following statement contain?
z == x +y;
a. Syntax error
b. Semantic error
c. logical error
d. All of the above
According to me it should be option a, but I am confused, how to get confirm answer with explanation.
View 11 Replies
View Related
Jul 2, 2013
I have no error compiling, but running my project it stops before entering a function and debugging I have an error about Segmentation fault. The function:
Code:
1
2
3
4
5
6
7
Mat logGabor(matriz filter,Mat filter,double r_o,double theta_o,double sigma_theta, matriz radius,matriz theta,int cols,int rows,double sigma_r,int *padSize){
[Code]....
View 5 Replies
View Related
Sep 22, 2013
i was suppose to write a program that gives a divide error but output is not showing anything like it.I am using orwell devc++ 5.4.2 and all the default built tools(gcc compiler etc.) with default settings.so, what should i do to see this error?
Code:
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,c;
float x;
}
[code]....
View 9 Replies
View Related
Mar 6, 2015
I've a code and it works on my linux laptop; however it doesnt work on a matrix server. Im getting error Code: file.c: In function CondCheck:file.c:40:3: warning: this decimal constant is unsigned only in ISO C90 [enabled by default] The code of the programme
Code:
#include <stdio.h>
#include <string.h>
#include <math.h>
/*DECIMAL TO BINARY CONVERTER*/
int BinaryConverter (int bina)
}
[code]....
View 1 Replies
View Related
Feb 19, 2015
While trying to redo everything in c i have an error on a do while loop and i don't understand i've corrected everything else but i don't understand why the error occurs even though it says how to fix it it says error expected ) before token -line 18 part of code
Code:
int main(){
Beep (523,1000); // sound at 523 hertz for 1 000 milliseconds
char cPresent;
do
}
[code]....
this is just extra bits i've added on to the assignment but I've worked on the c++ code for a week now i have less than a day to redo it
View 2 Replies
View Related
Dec 17, 2013
So I tried to find some youtube videos on how to make a DLL, I found one, I also found several topics (like on msdn and stuff), but I have this code
header
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <Windows.h>
#include <string>
using namespace std;
#pragma comment(lib, "ws2_32.lib")
[Code] ....
And I'm getting these errors:
1>error LNK2001: unresolved external symbol "private: static char * PathSocket::cBuffer" (?cBuffer@PathSocket@@0PADA)
error LNK2001: unresolved external symbol "private: static unsigned int * PathSocket::socket" (?socket@PathSocket@@0PAIA)
error LNK2001: unresolved external symbol "private: static void * PathSocket::hIDTask" (?hIDTask@PathSocket@@0PAXA)
WHY is there static, and what does dllimport/dllexport does? also there are NO tutorials with variables inside dll >.<
I've been following this [URL] ..... and the video I already lost, however there's no
#ifdef MATHFUNCSDLL_EXPORTS
#define MATHFUNCSDLL_API __declspec(dllexport)
#else
#define MATHFUNCSDLL_API __declspec(dllimport)
#endif
in the video, why do we have to use that? [URL] .....
View 19 Replies
View Related
Feb 11, 2013
Here is my first program, I had to use a lot of if/ else statements. For some reason the last "else" (bolded) is giving me an error and not letting me run the program.
#include <iostream>
using namespace std;
const float MILES_PER_KM = 1.0 / 1.61;
const float KM_PER_MILE = 1.61;
const float FREEZING_F = 32.0;
const float FAHR_PER_CELSIUS = 9.0 / 5.0;
const float CELSIUS_PER_FAHR = 5.0 / 9.0;
const float MAX_F_TEMP = 100.0;
const float MIN_F_TEMP = 0.0;
[Code] ....
And yes, the if else's are indented properly, because there are no errors for the first 3 unit types, only for the last one ( 'F' ), and i have them all exactly in the same format.
View 5 Replies
View Related
Jun 2, 2014
I am writing a c++ program which uses a vector which contains rows and columns of a table.Unfortunately I got the following error:
IntelliSense: no instance of overloaded function "std::vector<_Ty, _Alloc>::push_back [with _Ty=CCellDescr *, _Alloc=std::allocator<CCellDescr *>]" matches the argument list
argument types are: (const CCellDescr)
object type is: std::vector<CCellDescr *, std::allocator<CCellDescr *>>Here`s the code:
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<iterator>
using namespace std;
[code].....
View 1 Replies
View Related
Nov 18, 2013
I am working on my final project for my class and after finally getting it to compile with no errors to finding examples/tutorials and following skeleton code I cam encountering a problem.
The program runs, asks all the correct questions but when it displays the base pay and total pay for all 3 employees it comes back as ( -1.0743 blah blah )
When they work over 40 hours it works correctly but when they work under 40 hours it displays those weird numbers in those sections.
// Kevin Johnson -- Overtime Pay -- Final Assignment
// Created 11/14/2013 // Edited 11/17/2013
#include "stdafx.h"
[Code]....
View 9 Replies
View Related
Feb 3, 2015
i made a ActiveX Library with C++ Builder XE3 for use in VB6
i want to throw a error like the dao360.dll do (VB6 stop on the correct line) not just show a messagebox
i try to many different "throw" (EOleException, EOleSysError, ..) but it always crash VB6
if i use SetErrorInfo or this->Error(), nothing happen
i cannot return a HRESULT my fonction return a Database* (the name of my CoClass)
View 14 Replies
View Related
Jul 25, 2014
I'm having a constant error in my DLL regarding one simple function: I get the error:
double *(double)' differs in levels of indirection from 'double (double)'
The declaration is:
extern EXP32 double *FAR PASCAL_CONV utc2tdb(double jd);
What can be the problem?
View 1 Replies
View Related
Nov 15, 2014
my code is :
#include<stdio.h>
int main();
{
printf("????
");
return 0;
}
error: expected identifier or '(' before '{' token
what do I have to do to run it?
View 1 Replies
View Related