49,761 Topics
| |
[CODE] #include <iostream> #include<stdio.h> #include<string.h> using namespace std; int main() { // cout << "Hello world!" << endl; int t,i,j,a,flag; char str[1000001]; cin>>t; while(t--) { a=1; scanf("%s",str); for(i=0;i<=strlen(str);i++) {flag=0; if(!isdigit(str[i])) {flag=0; for(j=i-1;isdigit(str[j]);j--) { if(str[j]!='0') { flag++; a*=str[j]-'0'; //cout<<"flag"<<flag<<" "<<a<<"A"<<endl; break; } } if(flag==0) { a=0;break; } } while(a>9) { if((a%10)!=0) … | |
I need some help here.. I need an example to do that : ( a background task ) #includes blablalbalbla void?? ExecuteTask () { while(1) { cout << "first " << endl; } } int main () { ExecuteTask( ); while( 1 ) { cout << "lol" << endl; } … | |
Hello, I am doing simple read/write program for serial port. I am faceing a error that i donĀ“t understand. Error is: "error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char [5]' to 'LPCWSTR' " My whole program: #include <windows.h> #include <iostream> #include <string> using namespace std; void set_com_pin(bool … | |
Is there any C++ .Net IDE's around? I mean visual studio is ok.. it just isn't as good as SharpDevelop which only does C#, VB and a few others. It doesn't do C++ that's why I'm looking for a C++ version of SharpDevelop. Any Ideas? SharpDevelop [url]http://www.icsharpcode.net/opensource/sd/[/url] | |
Hello all, i working on a server I have realized that it only is using the loop back address of my ip. It looks like this. [CODE] struct sockaddr_in from; int fromLen = sizeof(from); SOCKET msgSocket = accept(listenSocket, (struct sockaddr*)&from, &fromLen); if(msgSocket == INVALID_SOCKET){ cout<<"Error at accept: "<<WSAGetLastError()<<endl; closesocket(listenSocket); WSACleanup(); … | |
My assignment is to create the Game of Life. I know that it is very easy to find out how to do this online, but I don't want the answers fed to me. Here's what I have so far: [CODE] // Life.cpp : Defines the entry point for the console … | |
So i have a program i am writing,and i have come to problem. I want to be able to pass a set of three strings into a function, which should then take them and add them to a Vector. All good so far, now is where my problem develops, how … | |
What I am trying to do is the following: [CODE] ReceiptBag zero("zero"); ReceiptBag one("one"); ReceiptBag bags[2]; bags = &zero; (bags+1) = &one;[/CODE] Of course that is not valid code. My goal is to be able to reference the same zero or one object by using its variable name or by … | |
hello, im totally new to this forum, but i already checked whether my ask is answered somewhere else already. i couldnt find anything... i used to work with dev-cpp and i have to work with the cnum.h library a lot. Since im a student i am able to get MS … | |
Hi Everyone, I am Actually trying to make a simple C++ game in which some random alphabets will fall down and when we press one of those random alphabets keys the aphabet should disappear. The problem that i am facing in making this code is that when i am using … | |
Hi! I am new to this forum and for c++ also. Can any one tell me the exact difference Createthread,beginthread,beginthreadex........ I have searched many links but not of much use...... Sharath. | |
Hi All, Why my QueueUserWorkItem is not at all working. My code is here: [CODE] typedef struct { PCHAR URL[MAX_URL] ; PCHAR DestinationPath ; }MAINDATA, *PMAINDATA ; int main(int argc, char * argv[]) { PMAINDATA pData ; BOOL bQuwi ; DWORD dwIndex ; PCHAR pURL ; pData = (PMAINDATA)malloc(sizeof(MAINDATA)) ; … | |
| |
Hi, can you have a quick look at the two for loops here. I've declared the int 'i' in the first for loop but in the second for loop it doesn't recognise it and i have to declare it again. Why is that? [CODE]for(int i=0; i<x; i++) { cout << … | |
Hi guys. I am a bit confused among the following three functions. read() readAll() readLine() How do they work? I'll be really thankful to you all. Thanks alot for your precious time! Regards. | |
hi all, i am working now in code::blocks and dev c++,but in both the cases output is not coming in fullscreen.so,how to view output in fullscreen? thanks in advance | |
I was studying for an exam and came across two questions that me and my friends didn't know the answer to. We are given the answer but we just can't figure out what the answer is what it is. First, why does this code give an error? [CODE]int z=5, q=2; … | |
I am looking for fastest API to read/write files. Can you please help? I have checked such discussions here. But I am not able to figure out from those discussions. Please help. | |
1 1 0 1 0 1 1 0 1 0 1 0 1 0 1 How To Print The Above Pattern ?? (Using For-Loops Only) | |
Here are program instructions. IT SAYS "segmentation fault" WHEN RAN. Specifications You must create a Ship class: The Ship class maintains the position data for each ship/vessel and its distance from another Ship. It has a default constructor, which sets all of the member data to zero, and a non-default … | |
my problem is that when I try and run it it says 'SortedList' : cannot instantiate abstract class due to following members: 'bool BasicADT::isEmpty(void) const' : is abstract ...and... 'int BasicADT::getLength(void) const' : is abstract can someone please tell me what I am doing wrong with my getLength and isEmpty. … | |
Hi, i want to write from one file to another. i managed to get the file to write but not in the way i expected it too, there is more to the program but for now i just need to know how can i mirror one file... My input file … | |
Just studying dynamic memory at the minute. I understand the idea of having dynamic memory for arrays so you can set the length of them within the running of the program. But what is the point of dynamic memory for a single type? If i set an 'int' up to … | |
Hello, I'm just wondering really.. I have a 2D matrix but I've defined it as a 1D matrix. So for example: [code] double *matrix = new double[N*M]; [/code] My question is, I'm going to be manipulating data very shortly and want to read this data in from a text file.. … | |
Hello, I joined about 5 minutes back. I need to complete my computer project, which is a hangman game in c++, by today. Based on what my teacher taught me, I have created a code that runs like this- [CODE]#include<iostream.h>//These are the only header files taught. #include<conio.h> #include<stdio.h> #include<stdlib.h> #include<string.h> … | |
Hello everyone! I'm looking for a free (open source preferred) source code editor. Ideally it would be as light-weight as Notepad++, gedit, kate, mousepad, you see the pattern. However, the most important thing I'm looking for in this editor is flexible, dynamic, intelligent autocomplete (for c/c++). To be fair, Notepad++ … | |
This code is giving me runtime error. Here, first I want to take a integer input which determine the number (n) of nodes in the graph. Then for n-1 time I want take two integer input which will give the adjacency information. [CODE] #include <set> #include <map> #include <list> #include … | |
I have some code in C++ that uses an std::vector of std::strings to store an array of strings. I need to convert it into C. I thought that I would just create c versions of the functions I need (vector.back,vector.push_back,string.operator+=) but am getting lost in the double pointers. Can anybody … | |
Pls help me on this. I really dont have an idea of solving this. Here's the question .. 1. Write a c++ program that generates the following series: 0 -1 4 -9 16 -25 36 -49 64 -81 100 and also this one 2. write a program that generates the … | |
I was wondering if there is any way using the mingw g++ compiler to make code that acts like this: [CODE]#define myLanguageBlock(X) doMyLanguageBlock(#X) void doMyLanguageBlock(const char* code){/*this executes the code as if it were in another language, I have already written this function*/} int main() { myLanguageBlock( this is all … |
The End.