C++ :: Why Decrement Part Of The Code Not Working
May 17, 2012
Code:
#include <cstdlib>
#include <iostream>
#include <string>
#include <stdio.h>
#include <windows.h>
#include <conio.h>
#include <exception>
#include <process.h>
using namespace std;
int main(int argc, char *argv[])
[code]....
View 10 Replies
ADVERTISEMENT
Jul 1, 2014
for example i have
int count = t1;
while(count>counter){
Sleep(delay);
Int32::TryParse(textBox2->Text,add);
result = result + add;
counter = counter + 1;
Problem is that sleep stops all program for specified time, Is there an alternative to sleep that would only stop part of code or can i use sleep different way to specify what it pauses?
View 8 Replies
View Related
Sep 28, 2013
printf is a part of code segment but found in data segment.....why is it so ?
View 7 Replies
View Related
Dec 28, 2013
how to get opengl working in code blocks? I have tried putting in the libraries and such in the correct folder. But I get an error saying that glut32.dll could not be found. I am running a 10.5 code blocks
View 1 Replies
View Related
Feb 10, 2013
I created a .txt file that I called in.txt. It has the letters: a b c d e. I put it in the same folder as the c++ code below. I was hoping that I after I compile and run the code, the in.txt file would read: e d c b a. Unfortunately, it doesn't. Even when I give the ofstream file another name, it does not create another text file.
Code:
#include<iostream>
#include<fstream>
#include <limits>
[Code].....
View 7 Replies
View Related
Dec 6, 2013
i have turbo c++ 3.0 installed . my program is compiled without error and is running. but when i choose option to display scores in the consol , it hangs . check my code. i have to run this on same compiler. i just want to display all the contenets of text file .
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
[Code].....
View 4 Replies
View Related
Jan 26, 2015
This program works on an online compiler but force closes on codeblocks after entering the elements.
#include<iostream>
using namespace std;
int two_print(int x, int one[999]) {
int two[999][999];
for(int k=0, r=x; k<=x; k++, r--)
[code]....
View 6 Replies
View Related
Aug 8, 2013
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);
[Code] ....
View 6 Replies
View Related
Sep 29, 2014
Parts of this program are missing. The last few lines are confusing, since the variable 'a' gets incremented then decremented. But there are no loops. I understand that the value of 'a' is passed to 'c' before 'a' is changed in both cases.
But where, and when, do the changes take place? Is the decrement ever processed? Is there a better way to write these lines?
Code:
main(){ int a = 21;int b = 10;int c ;
c = a++;
cout << "Line 6 - Value of c is :" << c << endl ;
c = a--;
cout << "Line 7 - Value of c is :" << c << endl ;
return 0;}
View 5 Replies
View Related
Sep 25, 2014
Is it possible to increment and decrement in the same loop? I can do it with 2 loops but id like to do it with just one loop.
Code:
for(i=1;i<=5;i++)
for(j=5;j>=1;i--)
Is there a way to do both operations with one loop?
View 12 Replies
View Related
Feb 25, 2014
I am trying to call Display menu. If up key is pressed Displayed has to be incremented and stay in particular window if Decremented, go to previous Display function and show previous Display function. LCD & Keypad Shield Quickstart Guide | Freetronics
Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
static int button_counter=0;
[Code].....
View 13 Replies
View Related
Apr 27, 2014
I have two files NumDays.h and ClientProgram.cpp
clientprogram.cpp basically has the main module below
int main(){
// Initialized UDT object Declarations
NumDays hoursWorked_John; // Instantiate with Default Constructor
NumDays hoursWorked_Sue(36.9); // Instantiate with Initializing Constructor
NumDays hoursUsed_Sue(4.5); // Instantiate with Initializing Constructor
[Code] .....
I can't figure out anything to put in for NumDays.cpp so it's not there.
View 5 Replies
View Related
Sep 5, 2014
In the following program.
void main() {
int a=1;
cout<<a++<<" "<<++a<<" "<<a++<<endl;
}
If I execute the above program i should get 1 3 3. But I'm getting different values when I executed this program. The values that I get after execution are 3 3 1.
View 2 Replies
View Related
Sep 23, 2013
What is the answer and reason for the value of a and b
#include<iostream.h>
#include<conio.h>
void main()
{int a=3;
int b = ++a + a++ + a-- + --a;
cout<<"
enter a:"<<a;
cout<<"
enter b:"<<b;
getch();
}
View 5 Replies
View Related
Nov 5, 2012
I created a table called registration and I have set an auto increment ID for each record. The problem is when I delete a certain record the ID didn't remove or deleted, for example if I entered these records: -
1,Bob,Bob123,Bob_2@hotmail.com then if I deleted it the next id record will be 2 which is supposed to be 1.
here is the SQL Command:-
CREATE TABLE Registration (
Reg_Id INT PRIMARY KEY IDENTITY,
Name varchar (255),
UserName varchar(255) NOT NULL,
Reg_Password varchar(255),
Email varchar(255),
Reg_Rank varchar(255)
);
View 3 Replies
View Related
Feb 19, 2015
Im using a recursive function to sort array. The decrement operator is used to eventually get to base condition in function. Used debugger the size-- expression is not decrementing. I figured out how to fix it but dont quite understand it.
[coed]
#include "stdafx.h"
#include <iostream>
void selectionsort(int [], int);
int main()
{
using namespace std;
const int arrysize = 10;
[Code]...
View 3 Replies
View Related
Jul 4, 2013
Say I have a structure defined as such:
struct data{
char c;
int x;
};
And I want to create a function to print either c or x. However, I don't want to just use a switch or something to figure this out, I want to reference which part I'm outputting.
Now here's the twist
vector<data> dataList;
I need to access element x or c in the vector, but all I pass is the vector and which element, so that I might have something like:
void (vector<data> x, DataType i){
cout << x[0].i;
}
So now, if I pass either x or c (someway), I can output one of them.
View 19 Replies
View Related
Nov 3, 2014
Is there any way I can clear only a selected part of the screen? (I'm aware of system("cls"))
For example, when you enter a date, and is wrong, could it just errase that input and only say "Wrong try again" without errasing everything else you where doing?
In this case, a function that only errases what is in the while
while(not wrong)
{
cout<<"DIA: ";
cin>>obj.dia;
cout<<"MES: ";
cin>>obj.mes;
cout<<"ANIO: ";
cin>>obj.anio;
}
PS: Also, is there any whay in which you can ask the user to enter the date DD/MM/YYY?
View 1 Replies
View Related
Dec 7, 2013
Is it valid for an object to return an object of they same type? GetBlock method
class memBlock {
private:
char *mem;
unsigned long length;
public:
memBlock(char *data,unsigned long startPoint, unsigned long endPoint) {
[Code] .....
View 1 Replies
View Related
Jan 20, 2015
I am having a little bit of trouble with what should be a simple part in my code. For some reason it keeps looping the name part of the program and I seem to be passing over the problem in the code.
Here is the code:
#include <iostream>
#include <string>
using namespace std;
[Code]....
View 6 Replies
View Related
Nov 26, 2012
I have the following string: "type computer {dell}"
And I want to remove the {dell}
So that the output on the screen type computer
Or delete any clause between the two brackets {}
How do i do that ?
View 5 Replies
View Related
Sep 29, 2014
Code:
// string::erase
#include <iostream>
#include <string>
int main () {
std::string str ("This is an example sentence.");
std::cout << str << '
';
str.erase (10,8);
std::cout << str << '
';
Code:
Output:
I don't understand this program. What do these 2 numbers represent? The index of an element in a character array? The 10th character of the array is 'n' and 8th is a "space".
View 14 Replies
View Related
Jan 2, 2014
I'm having a problem converting part of a string to an integer.I used strtok to seperate my string and I have also a function for atoi but how to apply it to my strtok function.What i need is to change the char *years to an int.Have a look of what I got:
Code:
int main() {
char sentence[]="trade_#_2009_#_invest_#_DEALING";
char *word=strtok(sentence, "_#_");
char *year=strtok(NULL, "_#_");; // assigning NULL for previousely where it left off
char *definition=strtok(NULL,"_#_");
char *synonyms=strtok(NULL,"_#_");
[code]...
View 2 Replies
View Related
Mar 30, 2014
I have a character array that includes configuration bits that are 0x00, thus when I try and do a strcat it adds the appended string into one of those spots instead of the end of the array.
View 2 Replies
View Related
Jun 12, 2014
I'm writting an algorithm which equals to std::to_string. The inttostring part is fine, and the decimal_part too. But when the number digits > 5, the program loops infinitely.
#include <iostream>
#include <string>
#include <algorithm>
[Code]...
In this code, the program runs ok. But try to add a 5 at decimal_part. What should I do to get this 'decimal_part' ok?
View 6 Replies
View Related
Apr 18, 2014
I have a vector of sets, which I am removing any element which contains a certain value. For example, if I was looking for 2:
[0] 1 2 3
[1] 4 5 6
After the program was run, I would be left with just [0]4 5 6.
This is the code I have been using
auto iter = std::remove_if( clauseVector.begin(), clauseVector.end(),[propagator] ( const std::set<int>& i ){
return i.find(propagator) != i.end() ; } ) ;
clauseVector.erase( iter, clauseVector.end() ) ;
I want to know, is there any way I can tweak this code so that it only removes one part of the set rather than the whole thing. For example with above example, I would be left with
[0] 1 3
[1] 4 5 6
View 4 Replies
View Related