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


ADVERTISEMENT

C++ :: Multi-character Character Constant Error Message?

Sep 14, 2014

I keep getting this warning message and I do not know how to fix it. Is it because I'm using char to instead of strings to replace all 't' with 'lp'?

#include<iostream>
#include<string>
#include <stdio.h>
using namespace std;
char * scanf(char * a) {

[code]....

View 6 Replies View Related

C :: Syntax Error At The End Of Input And Warning (multi-character Constant)

Feb 18, 2013

Here's my code. The error's at the last line.

Code:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define max_con 30

void add_contact();
void edit_contact();
void del_contact();
void list_contact();

[Code] .....

View 6 Replies View Related

C :: How To Remove Multi Character Constant Warning

Feb 20, 2013

Here's the line of code with the warning

Code: if((addressbook[3][num][4]=='-')&&(strlen(addressbook[3][num])=='10'))

Or what might be the possible causes of such a warning?

View 2 Replies View Related

C/C++ :: Line Of Constructor Is Showing Error

Mar 17, 2014

#include <iostream>
using namespace std;
class qwerty{  
    public:
    qwerty();
    void dispalymessage(){

[Code] ....

why am i getting an error in the qwerty() line when i run the program?if i remove qwerty() then the program is runing fine...y this is happening so?

View 2 Replies View Related

C Sharp :: Saving Data In SQL Server Parameter Error Showing

Jun 1, 2013

I have an application with general customer detail.

It has TextBox and radio button.

First I have used if statement then code but on first step is working fine then error is showing.

try
{
if (textBox1.Text == "")
{

[Code].....

View 5 Replies View Related

C++ :: Error Reading Character Of String?

Jan 12, 2013

I am trying to record some information in a file and allow user to delete a record. I am facing this message in Autos section of MVS (Error reading character of string). Here is the code:

int removeRecord(string name, int &row)//remove a record
{
const string data="database.txt";
fstream records;
records.open(data.c_str());
const string cpData="temp.txt";

[code].....

If I delete the any row (except last roe) it works but then add a copy of last record (sometimes fully sometimes partially) at the end of the file!! if i delete the last record it does not do anything.

View 1 Replies View Related

C/C++ :: Missing Terminating Character And Int Main Function Error

Oct 6, 2014

I am suppose to make a program that when the user is asked "Enter a Letter for the day:" if the user enters M or m then the screen will output "The day of the week is Monday" and so on until Sunday. I looked over my code and everything looks right but I still get errors saying Missing terminating character " and int function main error.
 
#include <iostream>  
using namespace std;  
int main() {      
    char day;  
    cout << "Enter a letter for a day of the week: ";

[code]....

View 1 Replies View Related

Visual C++ :: Character Controller - Getting Error When Adding Pointer

Sep 29, 2012

I was trying to write a character controller but when I went to add my pointer to my character I get error

C2143: syntax error : missing ';' before '*'

I've looked at all my classes involved but I don't see any errors and Visual Studio doesn't report any other specific errors. Is there any way of finding the source of this type of error?

View 4 Replies View Related

C :: Program To Accept Only Numerical Values And Gives Error If Character Or Symbol Entered

Nov 11, 2013

How can i make my program to accept only numerical values and gives a error notice if a character or a symbol is entered???

View 4 Replies View Related

C :: Write Text And Find Frequency Of 1 Chosen Character In It - Input Error Handling

Dec 20, 2014

I'm new in programming, and trying to write a code in C. The requirement is following - to write a text, and to find frequency of 1 chosen character in it. The main thing is that program should check user input (for example, I want to check if user entered "char" --> then correct, or if entered "int" --> not correct). But the program still doesn't check. So I have:

Code:
#include <stdio.h>
int main(){
char c[1000], ch;
char i, count=0;
printf("Enter a text: ");
gets(c);

[Code] ....

Am I on my right way using if/else?

View 3 Replies View Related

C++ :: Data File Handling Error - Character Strings Not Copied On Text File

Nov 24, 2013

I have this code for a computer project... (store management) but the character strings are not copied on text file..

#include<iostream.h>
#include<conio.h>
#include<fstream.h>
class Store {
public:
char *item_name[5];
store()

[Code] .....

Now when i run the program, it gives a error :::
ERROR
address 0x0

How can i write these strings to the text file?

View 2 Replies View Related

C++ :: Reading Data Character By Character From Text File

Jul 25, 2012

Double values are stored in text file. 23.5 36.8 34.2 ... My teacher told me to read them character by character and then make words, like i have to read "2" "3" "." "5" and now have to make it or treat it as word and then using atoi(). I have to convert it into double. but i dont know how to do this....

View 5 Replies View Related

C :: Read From Stdin (File) Character By Character

Nov 10, 2013

I have to optimize a code for below scenario. I am reading stdin (a file redirected to stdin) character by character. How many chars are going to come is not known. After every few chars there is a seaparator. e.g $ as below

rhhrkkj$hghjhdf$ddfkrjt

While reading, if the separator arrives I'm processing the string stored before that separator and then continue reading stdin in same fashion, till EOF. I am using getc(stdin) to read chars.

Using gprof I can see most of the program time is spent inside main() , for this reading logic. Rest of the program is just some insert and search operations. I am getting time of 0.01 secs at the moment, want to reduce further.

View 6 Replies View Related

C/C++ :: Read Input File Character By Character?

Aug 10, 2012

How do I write an a program that will read an input file character by character?

View 1 Replies View Related

C++ :: How To Read TXT File Character By Character

Oct 6, 2013

In my program, I'm supposed to read a text file (the name of which is given to me as a command line paramater, as long with an integer), and display the text in a specific format (each line can only be as long as the integer). However, I'm having trouble even reading the text file. I don't know the syntax. I'm only allowed to edit the function that does the formatting, and the code in that is

void typeset (int maxWidth, istream& documentIn)

I don't know how to 'read' the file, as most examples online are ifstream, or openFile or something like that. What I want to do is just read the first character of the file, and continuously keep reading characters until the end of the file.

View 10 Replies View Related

C/C++ :: Replacing Character In String With Another Character

Sep 13, 2014

So I'm trying to create a function that replaces any instance of a character in a string with another. So first I tried the replace() string member function:

In my implementation file

void NewString::ReplaceChar(const char& target,const char& entry)
{
this->replace(this->begin(),this->end(), target, entry);
};

Main program

#include "NewString.h"
using namespace ...;
int main()

[Code].....

Instead of replacing the the l's with y's it outputted a long string of y's. Also, NewString is derived from the string class (it's for the assignment). the header and whole implementation file, already tested.

I've also tried, instead, to use a for loop in ReplaceChar() but I need to overload the == operator and I don't know how I should exactly:

bool NewString::operator ==(const char& target)const {
if(*this == target)
return true;

[Code]....

I want the == operator to test if the value in the char array is equal to target but I'm not sure how to pass in the position. I'm guessing the this pointer in ReplaceChar() is not the same as the one dereferenced in ==() because target is never replaced by entry in the string.

View 5 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++ :: 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/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++ :: 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 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







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