C++ :: Identify Floating Or Alphabets

Apr 28, 2013

I have this homework where i am implementing a code which does error checking

so basically i have 3 variables and i assigned them as integer. so my error check is asking that if i type a value for instance 1.2 it should output "X"...

View 19 Replies


ADVERTISEMENT

C++ :: Occurrence Of Different Alphabets In A String

Feb 28, 2014

how to recognize the occurrences of different alphabets in a string and print the occurrences of each alphabet in string..

View 1 Replies View Related

C++ :: Array With Both Numbers And Alphabets

Aug 22, 2014

I am unable to create an array which has to content elements(1E, 2E, 3E, 4E). I tried using char however I am unable to display as it only shows the letter E.

View 19 Replies View Related

C++ :: Sorting Alphabets And Numbers

Apr 20, 2014

My program reads a string of characters. Prints all occurrences of letters and numbers, sorted in alphabetical and numerical order. Letters will be converted to uppercase.Other characters are filtered out, while number of white spaces are counted.

The problem is it crashes when i run the program. Here is my code

#include <iostream>
const int SIZE = 100;
using namespace std;
int main() {
char *pStr, str[SIZE] = "", newStr[SIZE] = "", ch;
int count = 0, i = 0, j;

[Code] .....

View 5 Replies View Related

C/C++ :: How To Use Alphabets To Break Do While Loop

Jul 29, 2014

#include<iostream>
using namespace std;
int main() {
int choice[10] = { 0 };
int vote, highvote;
cout << "1 Lional Messi ";

[code]....

My problem is i have to stop the loop when i enter any alphabets, i tried a lot of method but still doesn't work.

View 5 Replies View Related

C/C++ :: Have To Identify Odd Number And Print Them

Apr 10, 2013

#include<stdio.h>
#define TRUE 1  
int formOddInt(int n);  

[Code]....

View 5 Replies View Related

C++ :: Identify Polynomial With Two Arrays Of Same Length

Oct 15, 2014

I wanna write a class for polynomials, but there are some bugs in my code. I want to identify a polynomial with two arrays of the same length, one that contains the exponents of the nonzero monomials, and the other that contains the coefficients itself.

for example: (shematically)
3x^2 +5x^100 shoud be identified by array1=(2,100) and array2=(3,5)

the size of that polynomial should be Dim=2.

it should be possible to change the size dynamically.

Code:

#ifndef poly
#define poly
#include<cassert>
class poly {

[Code] ....

PROBLEM1 the destructor isnt working:
virtual ~poly() {delete [] start;delete [] koef;} //destruktor
Error: This declaration has no Storage class or typ specifier.
Error: Expected an identifier.

PROBLEM2 the constructor isnt working:
poly::poly(int x=0)
Error: Expected an identifier
Error: Expected a )
Error: Expected a ;.

I dont know what the computer want to tell me??

View 6 Replies View Related

C++ :: Identify End Of Function Code At Running Time

Apr 16, 2013

I want to implement some "debugger like" tool (very limited one, just identify at running time the current stack trace, and print messages from the user) on some code that the user wrote. what I get from the user is a function name (in the beginning of it's declaration), and when the user want to print some message he uses some print macro I should implement.

My target is printing the stack call, and all the messages that the user wrote, in the right place on the running place.

By what c++ feature can know on running time that a specific function code has ended??

Its easy to push a function to some vector when it called (since I get its name from the user), but when it ends and return to the function called it...

View 14 Replies View Related

C++ :: How To Check Equivalent Of Randomly Generated Alphabets

Mar 23, 2014

//This code gives randomly generated alphabets and if equal will cout the alphabet which is equal

1 #include <iostream>
2 #include <cstdlib>
3 #include <ctime>
4 using namespace std;
5 int main()
6 {
7 int a;
8 char array[10];

[Code] .....

My question is how to check that randomly generated alphabets are equal e.g in 22 number line it should give output of equal alphabets if they are equal but it does not give equal alphabets what wrong in this code mention the wrong statement, how will i get right answer?

View 1 Replies View Related

C++ :: Identify Correct Function Pointer From Vtable?

Jan 21, 2013

We know that function pointer for virtual function are stored in a vtable.When we have multiple function pointer entry in vtable and we call one of the virtual function then how the corresponding or correct function pointer is retrived from Vtable? Who do this stuff? In assembly code i can not see any code or logic to detrmine the correct function pointer.

View 4 Replies View Related

C/C++ :: String Of Characters - Sorting Alphabets And Numbers

Apr 20, 2014

My program reads a string of characters. Prints all occurrences of letters and numbers, sorted in alphabetical and numerical order. Letters will be converted to uppercase.Other characters are filtered out, while number of white spaces are counted.

the problem is it crushes when i run the program

Here is my code

#include <iostream>
const int SIZE = 100;
using namespace std;
int main() {
char *pStr, str[SIZE] = "", newStr[SIZE] = "", ch;
int count = 0, i = 0, j;

[Code] .....

View 1 Replies View Related

Visual C++ :: Identify Which Of Two Subclassed Controls The Mouse Is Over?

Feb 11, 2013

I have a dialog app with two separate static controls. Both controls have been subclassed from CStatic derived class to implement drag and drop and double clicking. The class works just fine, but I cannot figure out which of the controls is being double clicked or dragged and dropped onto because I only have the code below operating. I need some method in the derived class to determine which control is being manipulated.

Code:
// header file
#pragma once
#ifndef __AFXWIN_H__

[Code]....

View 3 Replies View Related

C :: Identify The Invalid Expression - All Variables Are Integer And Nonzero

Feb 20, 2015

Identify the invalid C expression or choose "all are valid". Assume all variables are integer and non-zero.

7.
a) a+b-0 b) c+-a%4 c) xm6-24 d) xf3r6+2
e) all are valid

8.
a) xx+yy%zz b) z%(z%z%z)) c) ha+ha+ha d) x23-20.4
e) all are valid

[Code] ......

View 10 Replies View Related

C++ :: Count Number Of Uppercase Lowercase Alphabets / Digits And Other Symbols?

Jan 16, 2014

It should count from the text entered how many alphabets in uppercase and lowercase, digits, blank spaces and 'other symbols'.

This is the program below.

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

[Code].....

View 15 Replies View Related

C# :: Histogram - Identify Integer In Array And Insert Symbol For Every Single One

Apr 18, 2015

I am supposed to make a histogram. I succeeded in generating the integers for the histogram. But what I want to do is instead of displaying numbers in the console, I want something like "*" displayed for every integer there is in an array. It should look something like this.

*
****
*****
********
**********
******
****
***
*

As far as I understand, in some way I need to identify the integer in the array and for every single one of them I need to insert the symbol. I don't know how to identify it.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1{
class Program {
static void Main(string[] args) {
diceHistogram();

[Code] .....

View 2 Replies View Related

C :: Floating Point Operations

Mar 16, 2014

Code:
#include<stdio.h>
#include<conio.h>
void main()
{
float i;
i=0.7;

[Code] ....

If i do run the above program in turbo C/C++ complier, it outputs "h". But,if i change the code as i=0.6 and if (i<0.6), it outputs "w". Even if i change it to i=0.8 and if(i<0.8), then also it outputs "w".

View 4 Replies View Related

C :: Floating Point Number - NAN

May 8, 2014

Code:
#include<stdio.h>
#include<conio.h>
float square(float);
void main() { clrscr();
float a,b;
printf("ENter a Number");
scanf("%f",&a);

[Code] ....

In the above program, I am calculating the square of float number. But sometimes the number is entered as NAN and sometimes Output is NAN. What is NAN? I am entering floating point number, then y NAN is entered?

SEE the Image attached for the OUTPUT.

View 2 Replies View Related

C :: Integer / Floating Conversions

Apr 27, 2013

I got the following to compile and execute, but I don't understand how this works. Here is the code verbatim:

Code:
// Basic conversions in C
#include <stdio.h>
int main () {
float f1 = 123.125, f2;
int i1, i2 = -150;
char c = 'a';

[Code] .....

Okay, so first we have some variables declared as integers, floats, (and that char what it's doing). On the same lines we have values assigned to some of those variables. At first the "f2" and the "i1" confused me, but I think they're just variables whose type has been declared but have not received a value. So far I think I'm good. Then we get into the routines

I think​ I understand the first one. i1 didn't originally receive a value assigned to it, so when it says f1 = i1, then f1 (123.125) just becomes an integer, simple enough.

Then we get to the next routine and I'm like what dafuq??? So first we have f1 (123.125) being set to i2 (-150). wtf? So does that mean f1 is now going to have the value of -150? Vice versa? How are they becoming equal? Or does it have nothing to do with the values of the variables at all and just the type??? I'm just totally lost.

The output of that line is "-150 assigned to a float produces -150.000000." Which makes perfect sense to me written in plain English, but I don't understand how the C code works ....

View 4 Replies View Related

C++ :: Floating Value From Character Array

Dec 9, 2014

How to extract a floating value from a character array in separate variables .

Example : multiply 7.5 with 2

Out put : 7.5 , 2

View 1 Replies View Related

C++ :: Numbers After The Floating Point?

Mar 28, 2014

if we have a decimal number like c=3.46

And i want to set two number, a and b

now a= static_type<int>(c); so a=3;
and i want b= 46

which is the two numbers after the decimal how can I do that ? how can I set b = 46 ?

P.S: i do not know what c equals to. now it's two number after the floating point but it might be more or less

View 7 Replies View Related

C :: Floating Point Number Manipulation

Mar 3, 2013

I am having trouble understanding the mantissa of a floating point number. I have divided up the floating point number into the sign bit, the exponent and the mantissa, I have found the exponent, but I am not sure what to do with the mantissa? From what I have gathered so far i divide the mantissa by ten until I get a number between 1 and 10. after that i convert the number into a decimal with everything after the decimal point (or radix) being a fractional number. But when I do that on paper I dont get my intended number. How do i put the exponent and mantissa together to make a decimal from my floating point?

ex. input is 00111010000111111111011000001000
sign is 0
exponent is 01110100 which is 64+32+16+4-127=-11
mantissa is 00111111111011000001000 which would be 1.11111111011000001

When i convert that i get 1.99756622314 i dont know what to do with the -11 exponent and the answer i want is 6.1e-4

View 1 Replies View Related

C :: How To Convert Hexadecimal Into Floating Point

Mar 10, 2013

I'm trying to convert 4 hex register into floating point value using IEEE 754 floating point format. My device will reply 4 register value. The problem is that it always reply for example 0x10 as 10 when i use getc() hence using char variable to store it is not ideal.

Code:

union {
char c[4];
float f;
} conv;

View 4 Replies View Related

C++ :: How Many Floating Point Values Are In Array

Apr 6, 2013

Write a function named "sum" that takes as its arguments the following:

(1) an array of floating point values.
(2) an integer that tells how many floating point values are in the array.

The function should return as its value the sum of the floating point values. For example, if the array that's passed to the function looks like this:
0 1 2 3 4
5.8|2.6|9.0|3.4|7.1

The function should return the value as 27.9 as its value...I know I need to declare and intialize the array in the main function. I don't how to write the sum function.

View 2 Replies View Related

C++ :: Floating Point Representation - Comparing With Zero

Nov 1, 2014

I'm currently trying to learn about floating point representation in depth, so I played around a bit. While doing so, I stumbled on some strange behaviour; I can't really work out what's happening...

#include <iostream>
#include <cmath>
using namespace std;
int main(){
float minVal = pow(2,-149); // set to smallest float possible
float nextCheck = ((float)((minVal/2.0f))); // divide by two

[Code] ....

Essentially what's happening is:
- I set minVal to be the smallest float that can be represented using single precision
- Dividing by 2 should yield 0 -- we're at the minimum
- Indeed, isZero2 does return true, but isZero returns false.

What's going on -- I would have thought them to be identical? Is the compiler trying to be clever, saying that dividing any number cannot possibly yield zero?

View 5 Replies View Related

C++ :: Checking If Floating Point Value Is Within A Certain Range?

Jun 2, 2014

Suppose I wanted to check if a given floating point value is within a certain range. What would be Your recommended approach when considering simplicity, speed, portability, etc.?

View 7 Replies View Related

C++ :: Function To Return Floating Point Value

Oct 11, 2013

Function is not returning a decimal point value. Here is my function

int meanValueFunction(vector<int> arrayValues){
int sum = 0;
sum = sumFunction(arrayValues);
float meanValue = sum/arrayValues.size();
cout<< meanValue << endl;
return meanValue;

I want result in decimal point i.e 27.2 for the values (2 4 20 10 100) but it returns 27 instead.

View 2 Replies View Related







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