49,761 Topics
| |
[ICODE] #include "stdafx.h" #include <iostream> #include <iomanip> #include <string> using namespace std; char your_string[256]; char new_string[256]; void ReverseString(); int main() { cin.getline(your_string, 256); ReverseString(); cout << new_string << "\n"; return 0; } void ReverseString() { int x = strlen(your_string)-1; for(int y = x; y >= 0; y--) { new_string[x-y] = … | |
[ICODE] #include "stdafx.h" #include <iostream> #include <iomanip> #include <string> using namespace std; // prototype declarations void concatString(char szTarget[], char szSource[]); int main (int nArg, char* pszArgs[]) { //read the first string char szString1[256]; cout << "Enter string #1: "; cin.getline(szString1, 128); //now get the second string char szString2[128]; cout << … | |
Hi everybody i really need your help, this is my problem: I have a c++ dll that use MFC, i need to use it in a c# project I need to end with another dll that to use it in the c# project I just cant find solution all over … | |
I want to store several structs in a vector, but the struct has a template so I get a compile error, how can I store the structs in the vector? Example: [code]template<class First, class Second> struct foo { First f; Second s; }; std::vector<foo> bar; //error! [/code] | |
Is it possible to get the return value of a function started with the CreateThread function or is the only way I can get a value from it to use global variables? I searched but i found nothing. Thanks. | |
I ve just installed ubuntu intrepid ibex (8.10.) on my laptop i have been using it for a while already but i just wanted to clear the system completely so i installed it, put some updates, some programs, but i also installed CodeBlocks using synaptic manager. Everything finished smoothly. Now, … | |
Hi, Ive started on doing some animations in win32 but i cant seem to know how to set the starting position without messing up the movement. Also all my animations are flickering. this is my code so far exluding the intializing, windows creations and such. [code=c++] typedef struct _REDINFO { … | |
I have two questions, the first of which is simple but I can't think of what the answer is: <code deleted and saved as attachment> lol sorry... I get the following complier error: <errors deleted and saved as attachment> why is 'string' undeclared? Where do I declare it? It is … | |
is there anyone that can look at my small program and tell me what I am doing wrong? If I submit it to you? I am trying to learn C++ and I am a newbie. Here is my zipped file | |
I have a linked list of operators ()+-*/ , how would I be able to compare them if they are all of type char? I looked at the ascii table, but they are all out of order so that isn't a choice. | |
well, after hours apon hours of serching for this, i've come up with nothing but a few sources for some plugins[from thecodeproject.com], which don't cover what I need: Basically writing to the currently active (source) file(at the position of the cursor/caret), like so(highly simplified) [code=cplusplus] fprintf(pOpenDocument,"/*\n\tTime: %s\n\tDate: %s\n\tAuther: %s\n\tReason & … | |
In Linux the output is printed correctly, with 'lines2' having the same value as 'lines' minus 1, but in windows the value of 'lines2' and is always printed as -2. The source code is solely for testing purposes, hence the messy code with no for loops, bad variable names etc. … | |
Hi guys :) I have small question of course I don't want to ask for solving my homework, no i'll work on it on my own. I just need some tips :) please. I want to make a program that calculate these function: F1 = 1; F2 = 2*lgn + … | |
I am trying to solve an algorithmic problem. First of all the user inputs the coordinates of some nodes. I have to go to the node with the biggest x( let name it E) and then to return to the start that will always be the node (0,0)( let name … | |
I have an assignment where I need to create an inventory program where I can add information about a product to a text file, and shown in the file like shown: 1;Hammer;20;13.50 Where 1 is the record number, Hammer is the description, 20 is the quantity, and 13.50 is the … | |
Below is the code which is supposed to round to two decimal places, i.e. 1.2874 is suppose to round to 1.29, but rather gives me 128.0000. What am I doing wrong need help fast! #include <iomanip> #include <iostream> #include <cmath> using namespace std; double roundIt(double x, double n) { x … | |
[code=c] #include<iostream.h> #include<string.h> void main() { int ch,n,phy_id[10],phy_workex[22]; char phy_name[12],phy_spec[30]; char pat_name[20],pat_gender[10],pat_case[50],ass_phy[12]; int m,pat_age[4],pat_cardno[20],pat_date[4]; do { cout<<"\t\t\t TASK SELECTION WINDOW \n"; cout<<"\t\t\t ********************* \n"; cout<<"\t What would you like to do ?\n"; cout<<"\t Please enter the number you choice \n"; cout<<"\t 1.Register a physician/s \n"; cout<<"\t 2.Register a patient/s \n"; … | |
so im writing this code, trying to do an exercise with friend functions and all that I have that part down, I was told to take my original code and put in what you see now "Make function add of type AltMoney. Thus, this function now computes the sum of … | |
I am supposed to read in data from a file, create a linked list, and be able to traverse it. I feel like I have the first part of the code correct but I get a segmentation fault when I try and run the program and the pgm4.rpt file is … | |
Hello, I am trying to create a program where I can work with an array of char that contain either 0 or 1 representing a decimal number that the user enters. Basically I need to convert a decimal number into binary and store it into a char array. I wrote … | |
Hi, i just need to know is there any method in MFC / C++ which will do the validation for the entered date. ie if the date 12/11/2008 is given as input it should return saying the date is valid.i hope there exsists some standard function. it should also check … | |
So i have the following code: [CODE] //main program char username[15] = {'r','g','f','i','r','e','f','l','y','2','4'}; char password[9] = {'1','2','3','4','5','6','7','8'}; if(client.Send(15,9,username,password)) { printf("Connection Successfully Established"); } [/CODE] [CODE] //class file bool Class_Name::Send(int usize, int psize, char *username, char *password) { itoa(usize,sendbuffer,16); // works fine itoa(psize,sendbuffer + 1,16); // works fine for(int i = … | |
Hi. I am looking for a way to load the windows COMMDLG.DLL from my C++ program and open the print dialogue box. Thanks for any help! | |
This is for c++. Ok, I have most of this done but can't quite figure out how to get the queue to appear on screen. I also think I may have messed up my loops as well. What it is supposed to do is ask what the user wants to … | |
hello! I am trying to learn how to do paralell processing. I am baseing this on an example that I saw here: [url]http://www.codeproject.com/KB/recipes/sseintro.aspx[/url] the one titled "SSETest Demo Project" I tried to make my own, and don't understand why it isn't working. Here is the code: [code="cplusplus"] // testconsole.cpp : … | |
Hi, all. I have one question: I am writing my-string class now according to the assignment. And like other String class assignment, we have to overload the operator, do the difference type constructor, etc. Well, i almost finish my assignment. But there have one problem with my code. I am … | |
Hey all, I am trying to first write an array to a text text file, delete the array, then later in the program I need to use the array again so I need to open the text file and read the array and call it the same name as before. … | |
I am sort of new to Win32 API programming with C++ and I am having an issue trying to save what is in the textboxes to a file when you hit the close button. I am using the WriteFile() and CreateFile() functions. Everytime I try to do it I get … | |
Hello, I have a problem where I need to delete any occurrence of "~" from a string. I created a function but in the end, it only deletes half of the "~" and leaves the other half.... [code=c++] string goodstring(string inp) { for (int i = 0; i < strlen(inp.c_str()); … |
The End.