Hello, this is my first post. I need help with this assignment here, dont know where to begin! maybe I should use strstr()? The output needs to be what is shown at the bottom. I cant use the string class, only c-style functions. Any hints would be welcome thank you! #include <iostream> #include <fstream> #include <cstring> using namespace std; //Prints the characters in the string str1 from beginIndex //and including endIndex void printSubString( const char* str1 , int beginIndex, int endIndex ) { //code needed } void printWordsInAString( const char* str1 ) { //code needed } int main() { char …

Member Avatar
Member Avatar
+0 forum 1

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
Member Avatar
+1 forum 13

So I have a poker type program where it should shuffle and deal a deck of cards using arrays of pointers. I have to write a function that uses a pointer(s) to determine if the hand contains an Ace. If I can understand this one, I'd be able to do the rest with no problems. I was told to do what I did with int decks, int dealt, int the_hand, but I keep getting errors. I've been trying everything I could think of, but no luck. Am I even in the right direction? Also, I read the book, reviewed my …

Member Avatar
Member Avatar
+0 forum 12

How much day's require to learn C++ ?

Member Avatar
Member Avatar
+0 forum 7

I want to create a game that computer guesses the number that i think between 0-500 but i am a beginner and i do not know what to do could you help me please ?

Member Avatar
Member Avatar
+0 forum 1

program buys internet packages with credit (pulsa) with do while loop . Dev c++

Member Avatar
Member Avatar
-2 forum 1

I have some problems when working with Win32 api. 1. Changing the text and background color of a button doesn't take effect. My code: case WM_CTLCOLORBTN: COLORREF colorref; colorref = RGB(0,0,255); HBRUSH hBrushBtn; hBrushBtn = CreateSolidBrush(colorref); return ((LRESULT)hBrushBtn); break; 2. How do I create selectable text. My code: text = CreateWindow("STATIC","text",WS_VISIBLE | WS_CHILD , 0,0,100,60, hwnd , NULL, NULL, NULL); 3. How do I create a filled rectangle?

Member Avatar
Member Avatar
+0 forum 3

Algorithm 1) Choose the time quantum and assign it for each process. 2) Allocate the CPU to the process according to the FCFS scheduling. 3) If (burst time of the process < time quantum).{Allocate the CPU to that process till it terminates.}Else {The process will occupy the CPU till the time quantum and it is added to the tail of the ready queue for the next round of execution.} What is the code of this Algorithm in c++. the following states have been executed in the CPU Scheduler 1. When a process switches from the running state to the waiting …

Member Avatar
Member Avatar
+0 forum 1

Hey, I don't know if this is the right place, but my issue is taking an output from a software SPI and using it in another function for temperature. The code below is marked with my issue, however it's not the full code. The full code is for a lab assignment to display temperature and a clock on an LCD, and the clock is another problem on its own. Thanks in advance for any help. unsigned int SW_SPI(unsigned int Output) { bitClear(PORTC, CS_Bit); for (int i = 15; i >= 0; i--) { bitSet(PORTB, SClk_Bit); if ( PINB & 0x01){ …

Member Avatar
Member Avatar
+0 forum 1

I'm trying to setup mongoos server in a Winndows app. The server code needs to be in an infinite loop, so does the windows main loop. I put the server code and win loop on 2 threads, the problem is, the program hangs when executed. Is there a way to make this work Main Windows loop int mainLoop(MSG &messages) { while (GetMessage(&messages, NULL, 0, 0)) { TranslateMessage(&messages); DispatchMessage(&messages); } return 1; } Server loop int serverLoop() { struct mg_mgr mgr; struct mg_connection *c; static const char *s_http_port = "80"; mg_mgr_init(&mgr, NULL); c = mg_bind(&mgr, s_http_port, ev_handler); mg_set_protocol_http_websocket(c); for (;;) { …

Member Avatar
Member Avatar
+0 forum 4

Question: I have to do a program on alternating sums using vectors. I am not sure how to start this program. I thought about using an array and every even index add the value and every odd index subtract the value. Does that sound right? Any ideas?

Member Avatar
Member Avatar
+0 forum 16

I am using PySide2 for GUI. I have a "Rename Project" QAction. The function must be like this: 1. set enable to false if tab name is "*Untitled" or file is unsaved. 2. set enable to True if file is loaded. How to do this? 3. Whenever switching to tab, these functions should be observed.

Member Avatar
Member Avatar
+1 forum 5

How can I make this to continue until the user presses N? I've tried using while(1), while( option == 'y' || option == 'Y') but it kept giving an error for that, and if/else statements but no luck. So I decided to try a do while statement and same results, it seems it is working, but I don't know what I'm doing wrong. I even tried moving all the statements to different areas and still nothing. #include <stdio.h> #include <time.h> #include <stdlib.h> enum meme {YEE, KNUCKLES, DOGE, HARAMBE, BUTKUS}; int dankestmemes(void); // function prototype int main(void) { srand(time(NULL)); // randomize …

Member Avatar
Member Avatar
+0 forum 10

Hi All, In this program I have these 2 matrices . It will compare each element in each row of matrix[4][4] to 3 . If that value <= 3 then store the characters in the first row of matrix m_c[25][32] in an 2D char array (char clusters[40][40]). For example 3 numbers (0,2,3) of the first row of matrix[4][4] less or equal 3 therefore 3 characters (A,B,D) of first row of matrix m_c[25][32] will be store in the clusters. Similarly 3 numbers (0,3,3) in second row of matrix[4][4] less or equal 3 therefore 3 characters (B,D,F) of first row of matrix …

Member Avatar
Member Avatar
+0 forum 1

how avoid memory leaks? from here: http://www.winprog.org/tutorial/bitmaps.html i learned: GetDC() - ReleaseDC() BeginPaint() - EndPaint() CreateCompatibleDC() - DeleteDC() i must get the old selected object. select it when isn't needed and then delete it. so seen these constructor and desctructor: image(const int width, const int height) { if (isimgused==true) delete img; isimgused=false; if(isGDIPLUSIniciated==false) { Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL); isGDIPLUSIniciated=true; } SelectObject(hdcimage, obj); DeleteObject(btBitmap); DeleteObject(obj); DeleteDC(hdcimage); hdcimage = CreateCompatibleDC(NULL); btBitmap = CreateBitmap(width,height,1,32,NULL); obj = SelectObject(hdcimage, btBitmap); framecount=1; imageheight=height; imageweight=width; } ~image() { if(isimgused==true) delete img; if(isGDIPLUSIniciated==true) Gdiplus::GdiplusShutdown(m_gdiplusToken); SelectObject(hdcimage, obj); DeleteObject(btBitmap); DeleteDC(hdcimage); } and these function: void DrawHICONtoHDC(HDC hdc, HICON hIcon, int PosX=0, …

Member Avatar
Member Avatar
+1 forum 3

#include<iostream.h> #include<conio.h> class game { int a,b,c; public: void g() { cout<<"Enter value of a<<endl; cin>>a>>b; if(a<b) { cout<<a,<<endl; c++; } } }; void main() { game g1; g1.g(); getch(); }

Member Avatar
Member Avatar
+0 forum 2

Hi, How can I pass a c# string to C++ side of the app? Right now, I have all handling in Const char * format . When I pass c# string, c++ working fine when using Platform::String . But there is no good way of converting Platform::String to const char *. Any inputs from your side? Any help will be appreciated. Thanks.

Member Avatar
Member Avatar
+0 forum 9

i'm newbie in the programming in language c++ can i know what the code of update function and delete function?I have no idea to do this 2 function someone can help me? please...

Member Avatar
Member Avatar
+0 forum 3

Hi, below is my code for binary search algorithm. My question is, what if I enter more than 1 same numbers in the array? How should i modify my code to print out all the locations where that same number is found? For example, if I entered the number 2 at three different locations, let's say, array[3], array[6] and array[17], how should I ask my compiler to return all the three locations instead of one? P.S. the below code returns only 1 position even if the number is entered multiple times. Thanks in Advance :) // Binary Search Algorithm ... …

Member Avatar
Member Avatar
+0 forum 4

I have a web server app, and a client app that works like a browser. I get the desired response from the server app if I type my IP in the browser window, if I read the response to the client app I get an empty string. The client app works only if I read the URL of a website, but not with my IP. Client: #include "stdafx.h" #include "WinHttpClient.h" #include <iostream> #include <fstream> #include <algorithm> #include <regex> #include <string> #include <vector> #include <sstream> #include <utility> using namespace std; int getResponse(wstring url) { WinHttpClient client(url); client.SendHttpRequest(); wstring page = client.GetResponseContent(); …

Member Avatar
Member Avatar
+0 forum 5

I'm trying to build a client and a server in the same program. For example, user 1 sends a packet of data to user 2, user 2 after receiving the packet sends back a different packet to user 1. The problem is, after running the program neither user receives the packets. #pragma comment(lib,"ws2_32.lib") #include <WinSock2.h> #include <iostream> static char buffer[8096 + 1]; char a[256] = {}; char MOTD[256]; int main() { //WinSock Startup WSAData wsaData; WORD DllVersion = MAKEWORD(2, 1); if (WSAStartup(DllVersion, &wsaData) != 0) //If WSAStartup returns anything other than 0, then that means an error has occured in …

Member Avatar
Member Avatar
+0 forum 12

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
Member Avatar
-5 forum 10

Hello, I am working on a small program that reads ten numbers, computes their average, and finds out how many numbers are above average. This is the set up I have so far: #include <iostream> using namespace std; int main() { double myList[10]; myList[0] = 89 myList[1] = 56 myList[2] = 34 myList[3] = 98 myList[4] = 87 myList[5] = 94 myList[6] = 100 myList[7] = 69 myList[8] = 52 myList[9] = 73 return 0; } .... Now I just need to know how to use it! Thanks for all the help!

Member Avatar
Member Avatar
+0 forum 14

Having 2 integers, by using their decomposition we want to calculate their binary gcd algorithm Please help me to write a c++proram. Unfortunayely, due to sanctions against my country Iran I can' t pay!

Member Avatar
Member Avatar
+0 forum 1

Coin game: Alice and Bob are playing a game using a bunch of coins. The players pick several coins out of the bunch in turn. Each time a player is allowed to pick 1, 2 or 4 coins, and the player that gets the last coin is the winner. Assume that both players are very smart and he/she will try his/her best to work out a strategy to win the game. For example, if there are 2 coins and Alice is the rst player to pick, she will de nitely pick 2 coins and win. If there are 3 coins …

Member Avatar
Member Avatar
+0 forum 19

#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
Member Avatar
+0 forum 4

i have these GNU macro: #if defined __GNUC__ #define EVENT [[gnu::weak]] #elif defined __clang__ #define EVENT [[llvm::weak]] #endif #define IS_EVENT_DEFINED(sym) (static_cast<bool>(sym)) these macro works fine. and help me test if the function(even with a prototype) was defined. my problem is can i convert [[gnu::weak]] to Visual Studio code(for be compatible)? because the Visual Studio don't have 'weak'

Member Avatar
Member Avatar
+0 forum 5

We need to implement this game MS Visual C++,using animation.You have scattered letters and from them you have to make up a word,if you guess the word you get n points(n=size of word) ,the button "hint " removes 3 points,from the accountant by prompting one of the letters ,a "new word" button - remove 5 points and changes the word,button"new game " - nullifies the score and changes word.Good luck and thank you=)

Member Avatar
Member Avatar
+0 forum 1

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
Member Avatar
+0 forum 7

Hey. My question is to read from a csv file and provide a user functionality to sort and output the data by grades, name and student id.. The code is compiling and running. The trouble I am getting now is outputting the file to different files when being sorted out by name, id, and grade. I have created separate options that asks the user how s/he wants to view the file. The first option works fine, however, the other two options do not work (ie. the output files arent created just like option 1). I would very much appreciate the …

Member Avatar
Member Avatar
+0 forum 2

The End.