Member Avatar

How should i give space between my output numbers while i am storing them in an array ?Like if i ask user to enter numbers and one entered 12345 ,i want to display them as 1 2 3 4 5

+0 forum 0
Member Avatar

Hi. I just installed Code Blocks. I want to just get started with programming. It seems that I have to configure Code Blocks therefore, setting up a compiler. How should this be done? Help Leon

Member Avatar
+0 forum 4
Member Avatar

This is my code. #include "pch.h" #include <iostream> #include <Windows.h> #include <string> #include <ctime> #include <fstream> using namespace std; std::string AppName = "League of Legends"; LPCSTR LAppWindow = "Riot Client"; std::string AppStatus; bool IsAppAvil; bool Update; int main() { //Start App ShellExecuteA(NULL,"open","D:\\Games\\Riot Games\\League of Legends\\LeagueClient.exe\\",NULL,NULL, SW_SHOWDEFAULT); //Checking if app is running HWND hGameWindow = NULL; int timeSinceLAstUpdate = clock(); int AppAvailTMR = clock(); int onePressTMR = clock(); int Timer = 0; DWORD dwProcID = NULL; HANDLE hProcHandle = NULL; while(!GetAsyncKeyState(VK_ESCAPE)) { Timer += 1; if (clock() - AppAvailTMR > 100) { AppAvailTMR = clock(); IsAppAvil = false; hGameWindow = FindWindowA(NULL, …

Member Avatar
+0 forum 3
Member Avatar

hello, i'm newbie here and also in programming world. so I would to request help from pros here. my question is, how to print out number entered in random in ascending order WITHOUT USING ARRAY AND FUNCTION? let say the user key in 4, 56, 31, 90, 11 and the output would be 4, 11, 31, 56, 90. hope anyone would help me. thank you.

Member Avatar
+0 forum 28
Member Avatar

Hi. I wanted to create a GUI application with C++ as a personal project. I am using that because I have done a lot of GUI personal projects in Java but never in C++, so I want to try using a new coding language I learned. I don't know a lot about GUI with C++ (only header files and some library components of C++) so I decided to look up some information on how to do this in C++. However, when I go to look up information about non-editable radio buttons in C++ and more, I don't get a lot …

Member Avatar
+0 forum 5
Member Avatar

I've recently started learning C and I have a simple program that I can't get to work. (I'm pretty sure C++ and C are similar enough at the basic level not to cause any problems in this forum). I've tried it by substituting the scanf("%s", myName) captured string data with an integer instead and it works. I can't understand why it's not working with the string data. So, what it should be doing is simply printing out "Hi, MyName!" in the command line if the user enters "MyName" when prompted. It simply ends silently with nothing printed out otherwise. However, …

Member Avatar
+0 forum 1
Member Avatar

Hi, I am getting an error while making a vector. frame.h #include <wx/wx.h> class Frame : public wxPanel { public: Frame(wxPanel* parent, int xx, int yy); ~Frame(); private: int x; int y; } frame.cpp #include "frame.h" Frame::Frame(wxPanel* parent, int xx, int yy) :wxPanel(parent) { x = xx; y = yy; } Frame::~Frame() { } in another wxPanel , I am creating a vector- std::vector<Frame> vFrames; And using it in a function- FinalFrame::addFrame() { vFrames.push_back(Frame(this, 20, 40)); } And I am getting this error- `error: use of deleted function 'Frame::Frame(const Frame&)' ` Is this related to wx or I am coding …

+0 forum 0
Member Avatar

HI everyone, _SBLOCK *allocateMemBlock(size_t size) [ _SBLOCK *block = (_SBLOCK*)sbrk(0); void *memadr = (void*)sbrk(0); void *allocate_mem = (void*)sbrk(BLOCK_SIZE + size); if(allocate_mem == (void*)-1) [ return NULL; ] else [ block->next = NULL; block->isfree = false; block->size = size; block->memoryAddress = memadr+BLOCK_SIZE; return block; ]

Member Avatar
+0 forum 8
Member Avatar

[CODE]#include <iostream> using namespace std; int main() { int a,b,c, ope; cout<<"enter a value" << endl; cin >> a; cout<<"enter b value" <<endl; cin >> b; cout<<"enter operation (+ - * / and %)"; cin>> ope; if (ope == +) { c=a+b; cout<< c; break; } if (ope == -) { c=a-b; cout<< c; break; } else if (ope == *) { c=a*b; cout<< c; break; } else if (ope == /) { c= a/b; cout<< c; break; } else if (ope == %) { c=a%b; cout<< c; } else cout<<"entered wrong input"; return 0; } [/CODE] whats wrong with …

Member Avatar
+0 forum 10
Member Avatar

Hi All, i would need some advice from you guys from this forum to solve the reading of the CSV file that i had. for example, i have a file which consist of about 2000 records (below are the example of the records) 10/10/2013 10:25:09 AM,5.89,45,264.83,PTTTT 10/10/2013 10:25:13 AM,5.89,2000,11780.00, Some of the records are with the "PTTTT" and some dont. So how do i read the records for the part until 4th column and elimiate the PTTTT column ? Thanks

Member Avatar
+0 forum 5
Member Avatar

I am supposed to sort an array in ascending order..I have tried but then i cant get the results i want.I also tried to look it up in this forum but i still can't get it...Here is part of the code:[ICODE]void sort() { int size=10; int j,temp,i; for(i=0;i<(size-1);i++) { for(j=i+1;j<size;j++) { if(queue[i]>queue[j]) { temp=queue[i]; queue[i]=queue[j]; queue[j]=temp; } } } cout<<"Status: sorting done."<<endl; }[/ICODE] The result i getting is zero for everything...Please help me..

Member Avatar
-1 forum 12
Member Avatar

Hello. I am taking a "Data Structures" class. I have to create a code that will print the following "Output": 8 6 4 2 0 6 4 2 0 4 2 0 2 0 0 I tried doing this code three different ways. Here is the first way. I did a similar project in "Java" so I knew I needed a "Nested Loop. I just "re-wrote" the code in "C++" but it does not print the correct numbers. I have to print the numbers in a way that the numbers count by "two's" and not "one's": for(int i = 8; …

Member Avatar
+0 forum 2
Member Avatar

I'm trying to add insert functionality to a textbook code example. I have an "off by one" error and I can't think of a way to fix it. Here's my attempt below: template< class NODETYPE > void List< NODETYPE >::insertMiddle( const NODETYPE &value, int position ) { ListNode< NODETYPE > *newPtr = getNewNode( value ); ListNode< NODETYPE > *curr = firstPtr; ListNode< NODETYPE > *curr2 = firstPtr; if ( isEmpty() ) firstPtr = lastPtr = newPtr; else { if (position == 1) insertAtFront( value ); cout << "curr->data is: "<<curr->data<<endl; for (int i = 1; i != position; ++i) curr …

Member Avatar
+0 forum 3
Member Avatar

Hello! I am interested in the issue of protecting the code from hacking. Do you protect your code from decompiling and hacking? Why did the question arise? I worked in a team that developed games for Android. They all used obfuscators! So almost no one could hack their application. Now I am interested in the topic of code protection. I looked at the existing topics, they are slightly outdated (8-10 years ago were relevant). Use / not use obfuscator? Which to choose?

Member Avatar
+1 forum 15
Member Avatar

i create the read(...) function for read to variables. but i need too the read()(without arguments) for press enter before continue\exit. void read() { //wait if the enter key is pressed: cin.ignore(); cin.get(); } template<typename first_t, typename... rest_t> void read(first_t &first, rest_t... rest) { std::cin >> first; read(rest...); //function is recursive //when the parameter pack becomes empty //read(); will be called with no parameters //which is why we declare it above } void read(string &parameter) { std::getline (std::cin,parameter); } void read(char *parameter) { cin.getline (parameter, 256); } read(); the problem is that i need press, 2 times, the enter for …

Member Avatar
+0 forum 11
Member Avatar

i'm trying using the GNU compiler with command lines( using the ShellExecuteEx()). when i do: string FileName1="C:\\Program Files\\mingw-w64\\x86_64-7.2.0-win32-seh-rt_v5-rev1\\mingw64\\bin\\x86_64-w64-mingw32-g++.exe"; run(FileName1,"-c \"C:\\Users\\Cambalinho\\Documents\\CB\\testfolder\\bin\\Debug\\test2.cpp\""); the object file is created. these line creates the exe: run(FileName1,"-o C:\\Users\\Cambalinho\\Documents\\CB\\testfolder\\bin\\Debug\\test2.exe C:\\Users\\Cambalinho\\Documents\\CB\\testfolder\\bin\\Debug\\test2.o"); (tested) but the exe have some dependencies... so seen the Code Blocks: x86_64-w64-mingw32-g++.exe -Wall -g -std=c++14 -c C:\Users\Cambalinho\Documents\CB\testfolder\main.cpp -o obj\Debug\main.o x86_64-w64-mingw32-g++.exe -L"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x86" -o bin\Debug\testfolder.exe obj\Debug\main.o -static-libstdc++ -static-libgcc -fpermissive "..\..\..\..\..\Program Files\mingw-w64\x86_64-7.2.0-win32-seh-rt_v5-rev1\mingw64\x86_64-w64-mingw32\lib\libgdi32.a" Output file is bin\Debug\testfolder.exe with size 2.92 MB Process terminated with status 0 (0 minute(s), 8 second(s)) 0 error(s), 0 warning(s) (0 minute(s), 8 second(s)) the "-static-libstdc++ -static-libgcc" adds the exe …

Member Avatar
+0 forum 8
Member Avatar

Hi all, I'm having a little problem with array and some "unqualified-id" problem. I've created gazillions (okay, maybe 80) arrays before but I had never encountered such problem. Especially with static arrays. [CODE] #include <stdio.h> #include <cstdlib> using namespace std; int main() { // with addition of buffers for 3x3 square mask // 8x8 original image is now 10x10 int [][] imageSquare = //12 { {4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, {4, 4, 4, 4, 4, 4, 4, 4, 4, 4}, {4, 4, 4, 4,48, 4, 4, 4, 4, 4}, {4, 4, 4,64,64,64,64, 4, 4, 4}, …

Member Avatar
+0 forum 10
Member Avatar

This is a tutorial, not a program. [b]Step 1[/B] First, create a file for your website, and name it "admin.html". [b]Step 2[/b] Now on it, say, "You must log in to view admin, blah,blah,blah. Click here to launch our client." [b]Step 3[/b] Link "Click here" with the C++ .exe file we will create later. [b]Step 4[/b] Now, create a new file with a bunch of random letters, then ".html". Make the file name AT LEAST 100 characters long. All your admin stuff will go here. [b]Step 5[/b] Now Start a C++ program, and type the following: [code=c] #include <iostream> #include …

Member Avatar
-5 forum 10
Member Avatar

#include<stdio.h> #include<conio.h> typedef struct process{ char pname[20]; int at,bt,wt,ta,end; }processes; int main(){ processes P[10]; processes z[10]; processes et[10]; processes wt1[10]; processes ta1[10]; int a,b,n,x=0,st,y,w; float aveta,avewt,sumta=0,sumwt=0; printf("Process Scheduling Algorithm:\n"); printf("SHORTEST JOB FIRST\n"); printf("--------------------------------------\n"); printf("Enter No. of Process: "); scanf("%d",&n); printf("\n"); for(a=0;a<n;a++){ printf("Enter Process Name P[%d]: ",a+1); scanf("%s",&P[a].pname); } printf("\n"); for(a=0;a<n;a++){ printf("Enter Arrival Time for P[%d]: ",a+1); scanf("%d",&P[a].at); } for(a=0; a<n; a++) { if(st > P[a].at) { st = P[a].at; } } printf("\n"); for(a=0;a<n;a++){ printf("Enter Burst Time for P[%d]: ",a+1); scanf("%d",&P[a].bt); } printf("\n\n ========================================================================\n"); printf("||\tPROCESS \t||\t ARRIVAL TIME \t||\t BURST TIME \t||\n"); printf("||----------------------------------------------------------------------||\n"); for(a=0;a<n;a++){ printf("||\t P[%s] \t\t||\t %d \t\t||\t %d \t\t||\n",P[a].pname,P[a].at,P[a].bt); …

Member Avatar
+0 forum 4
Member Avatar

hello there. i needed a little help in writing coding for reading multiple lines of data from a .txt file that are seperated by commas. Student Name, Student ID, Mark Ada Lovelace , S001 , 99 Barbara Liskov , S0123 , 44 Carol Shaw, S0023 , 55 Donna Dubinsky , S8333 , 33 Shafi Goldwasser , S934 , 77 Sophie Wilson , S11813 , 22 Frances Elizabeth Allen , S8254 , 66 After reading the data, the data has to be graded and sorted by name, id and grade. i would very much appreciate your guys help in this

Member Avatar
+0 forum 7
Member Avatar

Well, right now i'm following a tutorial on game making for c++, but is this really the best programming language for video games? Also i'd like to know if can recommend me a book ( i've seen some book on amazon but i don't really know wich one to choose ), or tutorial about this, cause since i'm just 15, there's no teacher ( yet ) to talk with about this kind of things ( Consider that i'm a really noob sooo... ) Well thanks and thats all

Member Avatar
+0 forum 38
Member Avatar

i have 2 sperate projects which i am trying to run together as a shared project but i am failing hard……. Basically, first project does infix to postfix notation and the second projects does postfix evaluation. tried to run all that in 1 project but i keep getting all sorts of error and cannot figure it out, I am kind of lost don’t know what to do. any suggestions would be really appreciated!!!!!!!!! the first 3 files is infix to postfix project and the last one is posftix evaluation. this is the calculator.cpp #include "stdafx.h" #include "Calculator.h" #include <iostream> #include …

Member Avatar
+0 forum 6
Member Avatar

Hello, I am building a calculator in c++ windows application form, i want the calculator to handle multiple operator precedence (for example, 2+4*5/3). but i am not sure how to write the following code on my windows form project. Any suggestions would appreciated . #include <iostream> #include <conio.h> using namespace std; int main() { int num1 = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0; char op1, op2, op3, op4; int total1 = 0, total2 = 0, total3 = 0, total4 = 0; cout << "Enter five values with operator to calculate=>"; cin >> num1 …

Member Avatar
+0 forum 6
Member Avatar

in working with my 2d arrays, i have to read in from an input file a char array of NxN and manipulate the matrix in various ways. i have gotten just about everything finished, except i cannot figure out the logic of shifting a row left or right, or shifting a column up or down. i know i have to temporarily store the last element in a row or column, and then i get stuck on figuring out moving an element from there. i have this for trying to shift a row right that the user specifies. this part here …

Member Avatar
+0 forum 8
Member Avatar

I’m new to this and talking an intro class. I’ve read and reread my course material so far and I can’t get this line to work. It has to display You have 2 even and 3 odd numbers but no matter what I do, it keeps coming out with 0 even and 0 odd. Tried used if (number %2==0){ number = even} If(number %2!=0){ number = odd} but that’s not working. Any suggestions

Member Avatar
+0 forum 4
Member Avatar

hello coders, i hope you all are going well, one thing blows my mind today in c i can't explain it this is why title is akward, so the thing is i have an array called tab[n] i wanted to invert it elements from tab[0] to tab[n-1] and and the tab[midle] would remain the same so i used intermediate variable x, max, half, what i get in resutl is just unexpected because before the entering the loop for the value of max is equal to 14 once once in the for loop max is equal to 0 i don't understand …

Member Avatar
+0 forum 5
Member Avatar

Good Evening, I'm working on my final project and I'm having an issue with reading input from a file and converting the string into an integer - specifically with the first character being read from the file. Here is the data in the .txt file created in notepad: 6 -1 -1 -1 2 -1 -1 -1 9 -1 1 -1 3 -1 7 -1 5 -1 -1 -1 3 -1 -1 -1 1 -1 -1 -1 9 -1 -1 -1 -1 -1 2 -1 2 -1 -1 8 7 5 -1 -1 3 -1 -1 5 -1 1 -1 4 …

Member Avatar
+0 forum 1
Member Avatar

write c++ programming that calculate electricity bill with persons name and id

Member Avatar
-1 forum 5
Member Avatar

Hi all, So before I went and posted ~800 lines of code, I have 2 questions: 1: What is the preferred way for us to post "complex" C++ (of course, this is just a .h, .cpp, and main cpp but it's still a lot of lines) that wont just be obnoxious to read/debug? (I guess.. what is the proper etiquette here?) 2: Maybe I don't have to post it, and I can get theory help - I have a socket server that spawns threads with mutexes to control everything as needed (I think I am doing it right). When I …

Member Avatar
+0 forum 7
Member Avatar

Is it possible to know which connection sent data wiht recv()? Current setup is - Main Thread spins and waits - Thread 1 - do stuff unimportant to socket - Thread 2 - accept() -> keep linked list of accetpted sockets - Thread 3 - recv() -> can I know which IP addr/connection sent me the data I am currently reading? Thank you :) Ryan

Member Avatar
+0 forum 1

The End.