I'm a bit stuck on a program that prints out a 8x8 chessboard and Q to represent queens where the user enters input. The intended output is: Code: Enter the columns containing queens, in order by row: 0 3 4 0 0 7 6 7
I am relatively new to C programming, and I am encountering numerous issues with this program that I cant seem to figure out how to fix.
First, when the user selects the arithmetic game, I keep on getting different incorrect answers from the arithgame function. For example, when I am presented with the question 3+2=_, sometimes the function claims the answer is the first number, 3, and other times the function gives me a multiplication answer, 6. This happens in both the addition and multiplication parts (ie. the multiplication answer will either be the first number or the addition answer).
Additionally, I cant figure out why my guessing game loops forever, rather than letting me guess until I get a correct answer.
I would like to modify attributes like modification/creation dates.The function is correctly working as if I type in "ls -al", the timestamp is correct. But when using my program to read these attributes, it returns the "real" modification/creation date. Here is the function that shows the timestamp :
Code:
time_t t = sb.st_mtime; struct tm tm = *localtime (&t); char s[32]; strftime (s, sizeof s, "%d/%m/%Y %H:%M:%S", &tm); printf ("%-14s %s", lecture->d_name, s); And here is the code for modifying the timestamps : Code: void modifyAttributes(char * file, int mtime, int atime) }
I'm having troubles with this program I made. Put it simply, it's a basic program using Queues. Whenever I try to input a value, my compiler(Dev C) suddenly stops working. The .exe file crashes and I've no way on how I can execute my program.
Code : #include<iostream> using namespace std; int *queue; int rear, front, queueSize; void enqueue(); void dequeue(); void display();
I'm not sure what I'm missing. It is supposed to input and display player's name and score, calculate the average score, and display the players who scored below average.
It simply doesn't work. All I get is a black screen. Debug spits out an exit code of 1073741510 (0xc000013a).
Code: #include <iostream> #include <string> #include <iomanip> using namespace std;
const int arSize = 100; int inputPlayerData (string playerName [], int playerScore [], int &numPlayers);
I'm trying to write a C++ program that will allow a user to input a number from the keyboard. Then using a loop, that will perform 10 times, multiply the entered number by the loop counter. Print out the loop counter, the entered number and the product of the loop counter and the entered number. A one-time heading should be displayed before information is printed.
This kinda of what I have so far:
#include <iosteam> using namespace std; int main () { Start Declare: numScores, sum, score, avg, SENTINEL = 200 numScores = 0
[Code] ....
All the programs I have tried to make are not working?
I tested my count funtion. So my count function is not working properly, it should return 5 because 5 words have prefix "tal," but it is giving me 10. It's counting blank nodes.
This is my main.cpp file
int main() { string word; cout<<"Enter a word"<<endl; cin >> word; string filename;
Here your supposed to create a program that takes in information and formats it into three columns.
I can't seem to use the float variable unitprice with decimal places here for, if I try to use %.1f and type in an input, the program seems to skip over the second scanf function, not allowing me to put input into the third scanf function as the program runs before I can.
I can use %f on its own and it works but this creates too many zeroes(and you're supposed to set the currency limit to $99999.99).
Code: #include <stdio.h> int main(void) { int itemno, month, year, day; float unitprice;
[Code]....
So the output should look like three columns. It's just the float that is the issue here....
I was given a task to convert infix to post fix using both linked lists and stacks in the code so this is what i have written but the problem is it is giving me same error at three different places "missing function header(old style format?)
#include <iostream> #include <string> using namespace std; const int size = 100; class stack{ private: // Declare a structure for the list
i am currently trying to get SDL working with C language.I am using Cygwin and Sublime text 2.I know and understand general programming, however i am trying to understand how to get SDL working with a file i create i.e test.c. i know to include which i have downloaded
#include <SDL.h>
where do i add the libraries so that i can use them in my program?
I am writing an irc bot in c++ on linux mint, and its not connecting right for some reason. anyways, heres the link: [URL].... . it was connecting to quakenet before I added the functions, but now it just says connecting... and then quits.
I'm learning network programming and I've decided to program a simple c++ irc bot. I'm able to connect to server and send commands. But when I try to receive and show message from server I first get a few lines, like "Please, wait, while we process your connection" or "Found your hostname". And then I start to get a ton of information about the server. Here is the whole class:
header file:
#pragma once #include <WinSock2.h> #include <WS2tcpip.h> class bot { public: bot(char *_server, char *_port); ~bot(void);
[Code] .....
Link to whole visual studio project: [URL] .... Am I doing something wrong during the IRC connection? Or I didn't understand how networking work?
for(c=0;c<100;c++) { m = c % 10; printf("%d ",m); } return(0); }
When I run this code in my compiler, I get the first nine or ten numbers, and then after that it just spells out the letters in my name in different sequences over and over.
1) Generate a series of numbers 2) Write those numbers onto a txt file and 3) Read only the odd numbers out of the txt file.
I have 3 functions besides main that do each of the objectives individually and when separate they work just fine. But when I put them together for some reason the third function is never started. Also when I rearrange the 3rd function infront of the 2nd (since i have the txt file already saved) it works but I get an error when trying to close the txt file. It is the same close function that I'm using when first creating the txt file as well.
Here is the code
Code:
#include <stdio.h> #include <stdlib.h> int main() }
I need to find out all the possible equations which are same of a given equation. For eg. a+b+c-d and b+c+a-d are same. So if the user inputs a+b+c-d then the output will be all the possible equations that can be formed from the given equation, viz:
a+c+b-d c+a+b-d -d+a+c+b
etc
i.e the program should rearrange the operands and operators in such a way that it should give the same result.
I have been coding this 2D physic engine for quite some time, I work on the many part of these 2 axis ( x and y ) in the same manner is just that one is an x and one is y
So there is a lot of duplicate code
If there is a bug in one part I have to fix the other axis too which becomes a hazzle because I have to fix the duplicates too. The sample code from my program
for( auto it =bodies.begin(); it != bodies.end(); ++ it ){ sf::Vector2f velocity = it->getVelocity(); if( velocity.x != 0 ){ // do some friction force calculation
[Code] ...
It is even more of a hazzle when I work with 4 quadrant, I have 4 duplicate code each ... How do I write a function for both axis ?
My SDL app which i made in visual c++ works properly on my pc, but it does not even starts on other computers. I have pasted all the required .dll files in my debug folder along with the pictures and sounds.