C++ :: CPP File Not Showing Code

Nov 19, 2013

i have been making code of a chessgame and now sddenly computer freezed and now there's not code in .cpp file! Although my .cpp file shows size of 16kb but when i open it . there's nothing except bank file

View 1 Replies


ADVERTISEMENT

C/C++ :: Showing The First Digit Of Zip Code?

Nov 21, 2014

My question is why my on my code there is 10 zip code and i want to show the first digit, the problem is the first digit does not match the zip code for example the zip code is 45805 it should be '5' however, my code shows other number!

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

[Code].....

View 4 Replies View Related

C++ :: Function In One Src File Called From Code In Different Src File - Linker Error

Mar 27, 2015

I have a function in one src file called from code in a different src file.

In ig_cfunc.cpp

Code:
#include "ig_tools.h"
int x2_count = 0.0;
float rel_branch_degree_tmp = 0.0;
string type;
vector<int> is_disp_type;

[Code] ....

I am getting a linker error,

Code:
ig_cfunc.cpp:1609: error: `calc_rel_branch_degree' undeclared (first use this function)

I have deleted all of the objects and recompiled to make sure that everything is in sync. I can't see what the issue is here and I'm not sure what to do next. This code actually worked until I changed the name of the function, so the types are all correct and such. This is the format I use for all external functions ....

View 1 Replies View Related

C++ :: SDL Font Not Showing

Jan 19, 2013

SLD_ttf lib and I have been following the Lazy Foo' tuts on it but the text is not appearing. I have found out that it is not loading the font as I have added in the code saying if it has failed.

Code:

font = TTF_OpenFont( "lazy.ttf", 28 );
if( font == NULL )
{
return false;
}

i have saved this font in the project (project name/project name/lazy.ttf).

View 19 Replies View Related

C++ :: Image Not Showing On Top

Jul 1, 2013

I am trying to display images on top of my Background image gui, so like buttons an stuff but the problem is that there not showing ontop. I can only get one of them to show

// includes
#include <windows.h>
#include <stdio.h>
#include "res.h"

// defines
#define LWA_COLORKEY 0x00000001
#define LWA_ALPHA 0x00000002

[Code] ....

View 1 Replies View Related

C/C++ :: Output To File Is In Hex Code

Apr 2, 2014

Here is program I have written which reads the destination, then finds it from a separate file, and reserves the information on a different file. But the reserved file has hex code information, how can I output my result to the file in normal alphabet/number/symbol characters? I've tried fputs,fprintf, and fwrite , and all give me the same result. The array c, is the one to be written to file.

void main {
FILE *afile = fopen("flightrecord.txt","r");
int i=0,j=0,k=0,z=0,y=0,sum=0,seat=0,g=0;
char destination[10],a[1000],c[1000],b[1000],name[100],last_name[100],c_number[15],plane[]={'P','6','2'};
printf("What is your destination?");
scanf("%s",&destination);

[Code] ....

View 14 Replies View Related

C++ :: Output Is Showing Address Instead Of Value

Dec 7, 2013

I've run across this issue before, but for the like of me, I can't figure out what keeps causing it. The problem compiles and runs as expected; however in the salaried object (Employee #1 in main.cpp) the console displays the number of vacation days as -858993460 instead of the value entered.

The parent Employee class is abstract with calculatePay() and displayEmployee() being pure virtualls and with a Benefits, Salaried, and Hourly class derived from it.

The Salaried displayEmployee() and the portion of the Main.cpp that contains the salaried object follows. What causing this?

Salaried displayEmployee()
Code:
void Salaried::displayEmployee()
{
cout << endl;
cout << "Employee Information" << endl;
cout << "----------------------------------" << endl;
cout << "Employee Name: " << setw(7) << FirstName << " " << LastName << endl;
cout << "Gender: " << setw(12) << Gender << endl;

[Code] .....

View 2 Replies View Related

C :: Float Showing Nothing In Printf

Oct 6, 2014

I just checking but confused with float. in that code same size int, and same type double are working but float showing nothing in printf..why?? i'm using GCC compiler int 32bit win7 os

Code:
#‎include <stdio.h>
int main() {
char arr[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
printf("Size of char=%c
", ((char *) (&arr[0]))[1]);

[Code] ....

View 14 Replies View Related

C :: Calculating And Showing RPM On Display

Feb 19, 2014

As part of a project i want to display the speed of a small wheel on a 7 segment display. I am using a hall effect sensor to pick up the pulses of the rotation. I am not sure how to write a programe on C to calculate the RPM from this....

View 4 Replies View Related

C++ :: Calculations Are Done Correctly But Showing Zero

Nov 26, 2013

#include <iostream>
#include <cstdio>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
const int SZ = 55;

[Code] ....

View 1 Replies View Related

C++ :: Tic Tac Toe - Board Is Not Showing Numbers

Feb 7, 2014

I'm programming tic tac toe but the board is not showing numbers, and it is simply stating the winner without any input: (the win conditions are not complete, but it shouldn't matter).

#include <iostream>
#include<string>
using namespace std;
//Write a two-player tic-tac-toe game; use enums when possible to represent the values of the board

char ticBoard[3][3];
char board[10];
void showBoard();
bool moveIsValid(int m);
int whoWon(); // 0 tied, 1 p1, 2 p.2

[Code] ....

View 6 Replies View Related

C# :: Variable Showing As Not Instanced

Oct 19, 2014

I'm receiving an error that an array has not been initialized but I'm not quite sure why. Also, I realize a list may be better in this scenario but I would still like to know what I'm doing wrong.

Warning in the IDE

Warning3Field 'Routines.SvrMain.Servers' is never assigned to, and will always have its default value nullD:Google DriveCodingC# ProjectsNONameWindowsFormsApplication1WindowsFormsApplication1Routines.cs26638WindowsFormsApplication1

Error that pops on line
Servers[Index].Address = Parser.ReturnAddress(); //returns an IPAddress

Object reference not set to an instance error

ServerDetails Class
public class ServerDetails {
public IPAddress Address; { get; set; }
public int Port { get; set; }
}

[Code] ....

View 12 Replies View Related

C/C++ :: Why Invalid Letter Not Showing

Feb 29, 2012

I wanna know why the program doesnt show "Invalid Letter Entered" when i enter any letter other than A S D or M

//Processing the data
    if (letter== 'A'||'S'||'M'||'D')// checking Add, subtract, multiply or divide {
        if (letter== 'A')//Adding the integers
            cout<<"Adding two integers = "<<first + second<<endl;
        else if (letter== 'S')//Subtracting the integers  {

[code]......

View 1 Replies View Related

C++ :: How To Output File Into New Program Or Code

Apr 24, 2013

//code
ofstream outFile;
outFile.open("p4a.dat");
outFile << setw(8) << "90.0";
outFile << setw(8) << "75.0";
outFile << setw(8) << "36" << endl;

[Code] .....

View 1 Replies View Related

C++ :: Code To Read 2D Array From TXT File

Apr 11, 2013

So the premise of my code is to read in a 2d array from a .txt. The array is a game board but the first two lines are what determine the size of the board. After i read it in i want it to find wherever te character "U" is, and then display the array but only showing U and whats around it. Problem is i cant get the array to print the right size and the code for displaying the U is not working either.

ifstream inputFile;
int boardSizeRow;
int boardSizeCol;
inputFile.open("C:UsersMichaelDesktopfileboard2.txt");
inputFile >> boardSizeRow;
inputFile >> boardSizeCol;
inputFile.get();

[Code]...

FILE:

20
20
WWWWWWWWWWWWWWWWWWWW
W GO W W
W WW w S W
W H W GW w W
WPW WW G W
WK W W
W W W W w w W
WK WU W
SW w w W
W W
w W G W
G W w W
D wwwww W
K w D W
w w W w w W
ww w WWWWWWW
G w W
ww w S w W
WWW G W
WWWWWWWWWWWWWWWWWWWW

View 5 Replies View Related

C++ :: Making Exe File From Source Code?

Sep 4, 2013

I use a programming language called layout which nobody here has probably ever heard of. It was discontinued over 15 years years ago but it was a very visual & easy to use piece of software - no coding required. In fact once you name all the variables on cards (forms) from then on it's just mouse clicking & occassionaly typing a number if required. It used blackboxes in a flowchart arrangement which were pre-done code for doing just about anything. i.e opening windows, handling numbers & text, files etc. I have written many programs with it including database management, quoting software & currently use it in my business to track my jobs & do invoicing & ordering. It's a pity it wasn't updated & still around today.

[URL]

Back to the problem. Being a 16 bit program it was written to run on Windows 3.1 but still works on Windows 7!! as long as it is the 32 bit version. I need to write a program that will run on 64 bit W7 without resorting to using a virtual PC solution. I have tried to find something similar that I might be able to use instead but so far nothing comes close to Layout. I just remembered today that layout can produce not only .exe programs but also various versions of C/C++ including visual c++. So I got this idea that if I could get those files I might be able to stick them into a C compiler program to re-make a "modern" exe file.

I could just do a simple sample program & send the source code to them to see if it works on a 64 bit version of Windows 7. how I can do this myself to produce a working exe file.

View 5 Replies View Related

C/C++ :: How To Append Txt File In Code Blocks

May 14, 2014

I've been using code::blocks to work on text files through fstream. But i cannot make it append using my code.

Here's my code:

#include <iostream>
#include <fstream>
using namespace std;
int main() {
fstream dataFile;
dataFile.open("demofile.txt", ios::out);

[Code] ....

View 2 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/C++ :: Code For A Server That Creates A Log File

Mar 12, 2013

I am trying to write a c code for a server that recieve msgs from a client and put that msg in a log file dedicated for that client along with the msg reception time and client IP address.......

The log file must be created if it doesn't already exist.....

Here is a code that i wnat to customize and it already opens a communication channel between server and client......

Here is my code:

#include "stdio.h"
#include "stdlib.h"
#include "sys/socket.h"
#include "sys/types.h"
#include "netinet/in.h"
#include "error.h"

[Code] ....

View 7 Replies View Related

C++ :: Imitate Code For Matrix In CMD Using Bat File?

Sep 25, 2014

I'm working on a project for my son. I want to imitate the code for the matrix in CMD using a .bat file.

~note: this is an example of whats going on, not the whole code

:start
@set /a bottomlimit = 0
@set /a upperlimit = 2
@set /a result1 = %bottomlimit% + %random% %% (%upperlimit% - %bottomlimit% + 1)
if %result1% == "2" set /a result1 = " " <- this is the part that is messing up, it doesnt change the 2 to a blank space and keeps echoing as 2
echo %result1%

View 2 Replies View Related

C++ :: Input Showing As Default Values?

Nov 30, 2013

Same solution that I was having compiler errors on yesterday. We're working with inheritance and the program is supposed to be to create and display information for default Employee objects, Hourly Employee objects and Salaried Employee objects. Everything compiles as is, but I'm running into two issues that I can't figure out.

1) In both the hourly and salaried objects, the wage, hours, and management level attributes all displaying their default values. I'm almost positive that this has something to do with the str to int and str to double conversions that I'm using (currently have atoi and atof in the file, but I've also tried stringstream, but still had to same problem). Any thoughts as to what I'm missing?

2) the assignment calls for the Benefit benefit member in Employee.h to be protected. However this makes the member unaccessible when I try to use it in the EmployeeMain.cpp in order to set the input for the Benefit class members. I had to make the Benefit benefit member public again to get it to compile. How would I set the input for the Benefit class members while the Benefit benefit member is protected?

Solution files follow:

EmployeeMain.cpp
Code:
#include "Hourly.h"
#include "Salaried.h"
void DisplayApplicationInformation();
void DisplayDivider(string);
string GetInput(string);

[Code]....

View 3 Replies View Related

C++ :: Fees Showing Up Wrong On Program

Feb 19, 2014

I'm writing a program that shows check fees for different amounts of checks. My other fees are showing up right but the .10 cents is not. It's showing up as .08 cents per check when I run the program.

Oh yeah the + 10 is for a $10 fee

Code:
else if (checks < 20 || checks >= 0) {
fee = .10 * checks + 10;
cout<< "Bank service charge for the month is $ " << setprecision(4) << endl;
}

View 3 Replies View Related

C :: Multi Character Is Showing Error

Mar 26, 2014

When i am entering single character instead of 'miz' then it is working great. But when i am using multi character like 'miz' it is showing error output. i did this program with c++ it is working but not working in c.When i am running this program it is showing {warning] multi character constant.

Code:

#include<stdio.h>
#include<string.h>
main()
{
char a;
printf("Please Enter your First Name: ");
scanf("%s",&a);

[Code]....

View 1 Replies View Related

C++ :: Allegro Sprite Is Not Showing Up In Right Spot

Jun 8, 2013

So I have a small game I'm making using OOP principles, I know it's a little bit of overkill but it's just for educational purposes. I have a sprite character that can be moved around with no problems, but I made a sword for him as a separate sprite that doesn't follow him. The sword sprite is supposed to cover his arm and his body as it swings, but it just stays in the upper left corner.

I messed around with the initialization of the sword in the main.cpp and I changed in sword.cpp and sword.h and it still is showing up in the same place. I even looked at the GetX() and GetY() statements I made and they seemed to work fine and when I debugged it, the variable values showed up correctly, but the sword doesn't move.

View 3 Replies View Related

C++ :: Showing Data Added To Classes

Feb 15, 2014

I am new to using classes, and am running into an issue already. I have created the class, and am in the process of adding data to the classes. I have added one piece of data, and now just want to see if I can get it to show in another function, but I am not sure why it is not showing. What about getting the data to show. Then, I will be able to work on adding the rest of the info.

#include <iostream>
#include <cctype>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
//******************************Bill Class**************************
class bill {

[Code] ....

FYI - This is only the relevant code. There is more for this that I have not added.

Error #1: error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

Error #2: error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

View 2 Replies View Related

C/C++ :: Showing Separate Lines For Objects?

Mar 31, 2014

#include<iostream>
#include<string>
using namespace std;
//Constructors for class.
class CollegeCourse {
private:
int courseNum;

[Code] ....

When I debug my program, the objects is showing up on one line bunched up together. I also want to be able to enter data after each object of the classes.

The details of my project is as follows:

Inheritance in C++ means you can create classes that derive their attributes from existing Classes, in other words, a newly created class can absorb all the data fields and functions of a class already being used. When one class is derived from another, the original class is the parent class, base class, or sometimes called the parent class. The derived class is a child class, or sometimes called the subclass.

Inheritance is central to Object Oriented Programming. The advantages of inheritance are it allows the code to be reused as many times as needed. Inheritance also saves time and effort as the main code need not be written again.

Create a C++ program using Visual program that could be used by a college to track its courses. In this program, create a CollegeCourse class includes fields representing department, course number, credit hours, and tuition. Create a child (sub class) class named LabCourse, that inherits all fields from the CollegeCourse class, includes one more field that holds a lab fee charged in addition to the tuition. Create appropriate functions for these classes, and write a main() function that instantiates and uses objects of each class.

View 1 Replies View Related







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