I have created a project in netbeans 7.2 and have not modified any setting. I have used all sorts of methods I could think/find but the code can not find the file.
I have placed my test.txt file in the folder of the project. Here is the location of the file:
C:UsersSAMARASDocumentsNetBeansProjects
eadFi le
However, I could not use it without modifying it as an absolute path.
For example, check the code from the FAQ. //well the return 0; is missing but this is not the problem now.
Or for example this code Code: bad code or with Code: myReadFile.open("C:/Users/SAMARAS/Documents/NetBeansProjects eadFile est.txt"); I have tried many things for placing the slashes, but could not find the file.
I have the following code and I am trying to do simple math calculations to the data. I need to take the car price (y) minus down payment (z) and then divide that quantity by 12 times "yearsx" That answer is then assigned to x. The problem is that x will not print the correctly!I also noticed that if I increase the "count" to amnything higher than the number on lines in the file, I get the correct value for x but only on the last set of the struct..my file reads as follows:
last_name first_name car_price down_payment years johnson bill 10,000 2,000 3
When I printf the struct to the screen, i need to do the following:
x = (10,000 - 2,000)/(12*years);
but this is the math part that wont work. I have checked and doubled checked number types and I cant get it right.
I'm trying to calculate a series of times from start to end, and find out the duration between them, sum them up and see if they're above a certain value or not, for each particular instance.
My goal is to provide a prepared text file with time tags such as this:
And the program is able to calculate the total time relevant to each instance (instances separated by a line of '=').
Some form of number should somehow identify each instance or something similar and a text file is generated with total time printed for each instance. E.g.
Now I'm currently working on making the logic to calculate time within the ranges I'd like based on several parameters.
Are there any references I can use when it comes to working with strings in order to seek and extract these values in order to work with them? The documentation available on this website, despite being very informative, does not show practical applications of said class and I'm at a loss on how to implement the functionality.
I am getting undefined references when compiling a project, however, there in no reference to external library and I am including all source file and header in the project , beside the only reference is to standard C header files. The undefined references error I am getting is for a header file whose source file is already present in the project.
I want to configure netbeans 7.4 settings for c++.I'm posting here because netbeans forums are close to dead. How to do the following things :-
1) When you create a new project of a 'new application' type, main.cpp is already there with some code. I want that main.cpp to be completely empty when I create a new project.
2) When you compile/build your program and run it, the output is shown in a small log window at the bottom. I want it to be shown like in a black output terminal (console ?) just like in Visual Studio or CodeBlocks. (I have some reasons for not using them instead, so don't bother about me not using them)
3) When you click the green 'Run' icon in the upper toolbar, the project is compiled/build again and then runs afterwards. I want it to just run without compiling. (Compiling/Building should be done by 'Build' icon, just like in CodeBlocks or Visual Studio)
I've already installed Cygwin and also set the ENV variables in Windows, but most fields are blank when I set Cygwin as the default build tool.
In addition, after setting Cygwin as the default build tool, my original MinGW seems to be affected. Now every header file, including <stdio.h> , cannot be found. " cannot find include file <stdio.h> " error message.
I tried changing the directories in the Tools>Options>Code Assistance tab it doesn't work too. [URL]
I am writing a program to hide files behind other files using Alternate Data Streams in Windows NTFS file systems.
The program is as follows:
Code:
#include <stdio.h> #include <stdlib.h> int main(void){ char hostfile[75], hiddenfile[75], hiddenFileName[15] ; printf("Enter the name(with extension) and path of the file whose behind you want to hide another file: "); scanf("%75s", hostfile);
[Code]...
The complier is showing error as "Extra Perimeter in call to system" but I am not getting where?
I am writing a piece of code that requires me to display the last 1000 lines from a multiple text files (log files). FYI, I am running on Linux and using g++.
I have a log file from which - if it contains more than 1000 lines, I need to display the last 1000 lines. However, the log file could get rotated. So, in case where the current log file contains less than 1000 lines, I have to go to older log file and display the remaining. For e.g., if log got rotated and new log file contains 20 lines, I have to display the 980 lines from old log file + 20 from current log files.
What is the best way to do this? Even an outline algorithm will work.
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.
I have this case statement that is not performing as expected. For some reason ASE_OK and ASE_NotPresent both print out. Why is this? ASE_OK is a return value of 0 while ASE_NotPresent is -1.
Code: // Try to create the buffers and store it switch (theAsioDriver->createBuffers(info, numChannels, bufferSize, callbacksInfo)) { case ASE_OK: std::cout << "ASE_OK"; input->bufferSize = output->bufferSize = bufferSize; // Buffer size is stored in both input and output case ASE_NotPresent: std::cout << "ASE_NotPresent"; errorMessage = "Could not find input or output devices."; return NO_DEVICES_FOUND;
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
okay so like case 2 and 3 is not working, also the program is still not finish but why isn't case 2 and 3 not functioning well on the switch part? case 1 works just fine
Code: #include<stdio.h> main () { //passcode part (passcode is 1234)
I have a program where the user inputs a line of numbers, and the two highest ones are displayed. It works fine, until negative values are entered at which point it shows 0 as the result.
Code: #include <iostream> using namespace std; int main( ) { int num = 0; int highest = 0;