49,766 Topics
![]() | |
I would like to generate output like this common, int, optional video, double, optional by karma with the structure [code] struct attr_struct { std::vector<std::string> name; std::vector<std::string> type; std::vector<std::string> use; }; [/code] So I defined some rules for it [code] #include<iostream> #include<string> #include<vector> #include<boost/fusion/adapted/struct.hpp> #include<boost/spirit/include/karma.hpp> namespace karma = boost::spirit::karma; namespace karma … | |
Can I not do the below code? [CODE] class box { public: box(){} box(int v){x=v;} ~box(){} int getx(){return x;} private: int x; }; ____________________________ #include <iostream> #include <queue> #include <cstdlib> #include <ctime> #include <windows.h> using namespace std; #include "Q4.h" int main() { queue<box> B; int a; cout<<"How many boxes would … ![]() | |
I am really confused as to the purpose of the unary + operator. What in the world does it do? I have tested it and it doesn't return the absolute value. Does it just return the operand? And if so what purpose is it?! (I mainly care about integer types) | |
Hi, The program I'm trying to make is to transcribe DNA to RNA and separate into codons. So far I was able to transcribe DNA to RNA and store it in string variable. Next part is to separate RNA strand into groups of 3 (codon) and store each group in … | |
I take some codes from [url]http://boost-spirit.com/home/articles/karma-examples/output-generation-from-a-list-of-key-value-pairs-using-spirit-karma/[/url] But it wouldn't compile My compiler : vc++ 2010 os : win7 64bits [code] #include<iostream> #include<string> #include<boost/optional.hpp> #include<boost/spirit/include/karma.hpp> namespace karma = boost::spirit::karma; namespace phoenix = boost::phoenix; int main() { typedef std::back_insert_iterator<std::string> sink_type; karma::rule<sink_type, std::string()> base = karma::string; typedef std::pair<std::string, boost::optional<std::string> > pair_type; karma::rule<sink_type, pair_type()> … | |
I want format out in cout , similar to the way printf supports the functionality. I read that iomanip can be used for that purpose. But the problem is at college we have to do in the ancient Turbo C++ and I dont think it has iomanip. I'm making an … | |
I don't know a way to enter string into a vector. For example, there is string s = "augcuuaucaca" and I want to separate the string s into groups of 3 characters such as "aug", "cuu", "auc", "aca" and each group of characters would be string type. After that, I … | |
For some reason, my program will not let the user enter his/her row number. Here's the code: [CODE]#include <cstdlib> #include <iostream> #include <iomanip> using namespace std; int a=0,A=0,b=1,B=1,c=2,C=2,d=3,D=3,e=4,E=4,f=5,F=5; void ticketchoices(); void displaychartfirst(char firstclass[2][6],int ticketnumselection); void displaychartbus(char busiclass[5][6],int ticketnumselection); void displaycharteco(char ecoclass[6][6],int ticketnumselection); int main(int argc, char *argv[]) { char X; … | |
Hi The following code shows good enough how to multiply two long data [CODE]long x = 10, y = 3; long p = 0; while (y > 0) { if ((y & 01) != 0) p += x; x <<= 1; y >>= 1; } std::cout << "\nResult : " … | |
I have just started programming in c++ (yesterday), my background is in HTML, CSS and Javascript. i'm on chapter 5: controlling program flow (c++ for dummies) currently creating a break in a "for loop". Anyway'z my problem is, when i build and run the program all action's i want the … ![]() | |
I actually intend to make a program using c++ which does the three following tasks: 1)lets me input the location and name of a jpg image file... 2)picks up the name of the file and stores it in a string...for eg if file name is myfile.jpg it picks up "myfile" … | |
Hi Guys, sorry for asking many questions, but i'm a newby to C++. I generated 2 dimensional array with number of rows defined by a user and number of columns set to 5. But I can't figure out how to substitute duplicating values with new unique ones. I can't use … | |
Hi there I am writing a game with some basic AI elements. The enemies know there position and the players position and so are able to rotate and follow the player around etc. The idea is that when an enemy gets within a radius of the player they calculate a … | |
I'm attempting to port a header file for a program that was designed for a Unix environment. i'm'; aware of the type defined variables like s16, u8 and such, but is their anything else i need to know about Unix C? not to familiar with it. thanks. sample portion of … | |
Okay, I'm still a fresh out of college programmer (only been doing it for 4 years), so I will try to be as descriptive as possible. I apologize now for anything that doesn't make sense. I've got a C++ project that using MFC to create forms. I have my main … | |
hi guys i am newbie in c/c++ staff and friend of mine told me that you can mix c/c++ and i thought it's cool but i want to see how it's work so please help.. if you have any simple example will appreciate ..thanks | |
Hey, I want to Shutdown the computer using Registry in c++.. i have googled and only one thing that i see about [B]ExitWindowEx()[/B].. But i have no idea about to implement in c++ program... So please help me .... | |
I am trying to sort a record according to their respective number like this: [CODE] 5 reyes d r 1 2 3 3 delos d k 4 5 6 9 go t r 7 4 5 1 po w w 2 2 2 2 bun b m 3 3 3 … | |
I am trying to build a binary search tree. The elements in my input file is printing, but with junk. The problem is with the sentinel in the while loop. I'm not sure of what else to try. I've tried: while (infile) while (count != 14 && infile.good()) while (strcmp(Str, … | |
Hi everyone. I created a [B]Windows Forms Application[/B] project which is [I]sending data to parallel port[/I] by using [B]inpout32.dll[/B] and I'm having following problems: [INDENT] When I test it on Windows XP, an error occurs "This isn't a Win32 application". Why? When I test it on my pc, it runs … | |
Hello! I have problem with class, the error is "Applik" : is not a class or namespace name. In mine opinion code is fine, and i cannot find solution, please help me i am beginner. This is mine code **App.h ** #pragma once #include <SDL/SDL.h> #include <windows.h> #include <gl\gl.h> #include … | |
I got the following error, please help me to resolve this problem.. ui.h:10: error: âloginâ has not been declared db.h:7: error: âloginâ has not been declared controller.cpp: In member function âvoid control::casino_game()â: controller.cpp:15: error: âloginâ was not declared in this scope controller.cpp:15: error: expected `;' before âloâ controller.cpp:34: error: âloâ … | |
i'm working on visual studio 2008. I'm trying use fopen to open txt files and it does not give any errors but its not doing the required task either. i've to submit this project on monday! please help here's part of the code: [CODE]#include <stdio.h> #include<iostream> #include <conio.h> #include <string> … | |
I'm making an SIC 2 pass assembler in C++. And I'm not very good at files in C++. The following code segment is supposed to read LABEL OPCODE OPERAND from the input text file . All it has to do is to identify each of those based on the tab … | |
Hello guys, Application : before into this program must to login first and next must select channel for talk with another user i will to do the program c++, it's can login , select channel (change channel every 10s (random)) and posting fix message similar BOT POSTING BUT i dont … | |
[CODE]#include<iostream> #include<cmath> #include<fstream> using namespace std; void readfile(int arr[][9],int s) { ifstream in; in.open("file.txt"); if(!in) { cout<<"File Not Found"<<endl; exit(1); } for(int i=0;i<s;i++) { for(int j=0;j<9;j++) { in>>arr[i][j]; } } } void possibilities(int arr[][9],int s) { int pos[9]; int x=0; bool check=1; int power=0; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { … | |
Hi, So I have a very simple server/client program using winsock. In C++. Using MingW as a compiler. This is the code part which does the connecting: [CODE]for(;;) { if(Connect = accept(Listen, (SOCKADDR*)&Server, &size)) { std::cout<<"\nConnection was reached"; } }[/CODE] How can I send and receive simple text from server … | |
Prekė.h [CODE] #include <string> using namespace std; class Prekė { private: string pavadinimas; double pagaminimodata; int kiekis; double kaina; double vartojimolaikas; public: Prekė(); Prekė(string pavad, double pagam_dat, int kiek, double kain, double vart_laik); ~Prekė(); string ImtiPavadinimą() { return pavadinimas; } double ImtiPagaminimoDatą() { return pagaminimodata; } int ImtiKiekį() { return … ![]() | |
Hi, I am running embedded mongoose webserver in server side (Linux centos). In the client (Windows) I am using c++ with libcurl to post request to webserver. It works successfully all the time. But now, I am facing ssl connectivity issue in client side. Without ssl, it works fine. If … ![]() | |
Hello all I need a little help finishing my assignment. I am given a text file that contains information about vehicles in an auto dealership. The vehicle records consist of the following fields: VIN, Make, Model, Year, Color, Date of purchase, Cost, Date of Sale, Sale Price and Revenue. The … ![]() |
The End.