Hello, I am trying to understand how to use C-style strings in C++. My goal is to store a C-style strings into a string type array. If I pass "This is a test" into word_token, it displays: This Is A test So from here I believe my setup is almost right, I'm just having problems passing these into a string type array Does not print out "This" as I expect it too myArray[*token] ; cout << myArray[0] ; void word_token(char *str){ string myArray[256]; // assuming str <= 256 words char spaces[] = " "; // deliminator char *token = strtok(str, …

Member Avatar
Member Avatar
+0 forum 1

In this case I display values into datagridview from Projects table which it has only 2 columns: PROJECT_NAME VARCHAR ID INT // Which is hidden in datagridview, and as AUTOINCREMENT I have already done with editing values in this table and it works fine: `private void dataGridView4_CellEndEdit(object sender, DataGridViewCellEventArgs e) { string name_project = dataGridView4.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); string id = dataGridView4.Rows[e.RowIndex].Cells[0].Value.ToString(); MySqlConnection connection = new MySqlConnection("datasource = localhost; port = 3306; username = root; password = "); MySqlCommand cmd = new MySqlCommand("UPDATE projekt1.projects SET PROJECTS_NAME = @PROJECTS_NAME WHERE ID = @ID", connection); cmd.Parameters.Add("@ID", MySqlDbType.Int64).Value = int.Parse(id); cmd.Parameters.Add("@PROJECTS_NAME", MySqlDbType.VarChar).Value = name_project; try { …

Member Avatar
Member Avatar
+0 forum 1

I need to extract the domain for example: (http: //www.example.com/example-page, http ://test.com/test-page) from a list of websites in an excel sheet and modify that domain to give its url (example.com, test.com). I have got the code part figured put but i still need to get these commands to work on excel sheet cells in a column automatically. >>> url = ("http://www.example.com") >>> domain = url.split("http://")[-1].split("/")[0] >>> print(domain) www.example.com >>> url_2 = ("http://example.com") >>> domain_2 = url_2.split("http://")[-1].split('/')[0] >>> print(domain_2) example.com >>> >>> #Now to remove www. from the first one >>> >>> domain_without_w3 = domain.split("www.")[-1] >>> print(domain_without_w3) example.com >>> >>> # …

Member Avatar
Member Avatar
+0 forum 2

currently working on a project for college. when searching coffee names from the array list , it will show the object but will also show "there is no coffee in the list" for every time the object doesn't match the search, how can I sort this out? public static void search () { boolean arrayName = false; if (numberOfCoffees > 0) { System.out.println ("search coffee"); System.out.println ("what are you searching for?"); String search = sc.nextLine(); for (int i = 0; i < numberOfCoffees; i++) { arrayName = coffee[i][0].equals (search); if (arrayName == true) { System.out.println("coffee found: " + coffee[i][0] + …

Member Avatar
Member Avatar
+0 forum 1

hi! I'm currently studying and having difficulty being able to print the array list, im not sure where im going wrong. any help will be appreciated import java.util.*; public class practice { static Scanner sc = new Scanner (System.in); static int numberOfCoffees = 0; static String[][] coffee = new String [50][2]; public static void main (String [] args) { int choice = 0; while (choice != 4) { menu (); choice = Integer.parseInt (sc.nextLine() ); if (choice == 1) { System.out.print('\u000C'); addItem(); } else if(choice == 2) { System.out.print('\u000C'); search(); } else if(choice == 3) { System.out.print('\u000C'); show(); } } …

Member Avatar
Member Avatar
+1 forum 1

The library optimezedr should determine if a collection of books is in ascending or desending order.Your solution must read books from a text file and produce 2 additional text files one in ascending order and one in Descending order. then your solution will indicate if your original text file in in ascending or descending order or not sorted .You can only use the following c++ libraries:iostrem,fstream and string. Could someone please help me with this thank you.

Member Avatar
Member Avatar
+0 forum 2

Hello, i need your help. I need to make a program which will make sum of digits in number e.g. 123 is 6 BUT, the number could be very big like 1000 digits long or more.(e.g. 1 005 854 684......) - of course without spaces So, i cannot use datatypes like unsigned long long int, because of it is not enough. Well, my idea is to store a number into string, then i have to make calculations to make sum of digits. So, my question is: Is it better to use string (char array) or Int array? Do i need …

Member Avatar
Member Avatar
+0 forum 3

This short Python code gets the local time from the PC as a formatted string using time.strftime('%H:%M:%S'). The time string is displayed in a label using a larger font. A recursive function checks the time five times per second, and updates the time string, if it has changed. Five times per second may sound like overkill, but keeps the display from acting spasmodic.

Member Avatar
Member Avatar
+2 forum 13

I have questions: 1) Program to get input from user till 'z' or 'Z' is inputted the program will check for the chars, and print (new line) small chars (new line) big chars (new line) numbers [without 'z' or 'Z'] can't use variables. only Stack. example : input: ASdf154sdgdf123vcvbz Small chars: dfsdgdfvcvb Big chars: AS Numbers: 154123 This is code for question 1: STA SEGMENT STACK DB 100H DUP (0) STA ENDS CODE SEGMENT ASSUME CS:CODE,SS:STA MAIN: MOV BP, SP MOV BX, BP SUB BP, 2 MOV CX, 0 INPUT: MOV AH, 01H INT 21H INC CX CMP AL, 'z' …

Member Avatar
Member Avatar
+0 forum 1

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

##vbScript - Some Useful String Functions Please see my post [vbScript - The Basics](https://www.daniweb.com/programming/threads/516400/vbscript-the-basics) for more details on vbScript. vbScript provides a number of functions for manipulating strings. I find that a few more simple functions would have made things a lot simpler. For example, I find myself checking to see if a string starts with a given string. What I have to code is If len(str1) < len(str2) Then StartsWith = False Else If Left(str1,len(str2)) = str2 Then StartsWith = True Else StartsWIth = False End If It would be much clearer if I could do If StartsWith(str1,str2) Then …

Member Avatar
Member Avatar
+1 forum 1

# my code in asp.net with sql server # my final task is to perform string matching and i know i use algorithm but i can use logic first i split the code in listbox .success 2nd step i match all the listbox items to sqlserver which contain 1 column ? how to match all the listbox item to database sql server ? for example in my database heading factorial in c++ when i enter query box factorial in java and then split to listbox like factorial in java that work done but how to match the listbox all items …

Member Avatar
Member Avatar
+0 forum 1

I've looked around this forum, and the rest of the internet, but my code is not working. Here is the problem: I read XML files that are in en-US culture. The decimal separator is a dot ".". Given the string "123.45", I want to convert the separator from a dot, to a comma. The current code doesn't work. [CODE] String tmp = "123.45"; System.Globalization.CultureInfo myInfo = System.Globalization.CultureInfo.CurrentUICulture; /****The above line returns my culture, es-ES where the number separator is ","***/ System.Windows.Forms.MessageBox.Show("New value: "+ Decimal.Parse(test, myInfo)); /***The above line displays the result "12345"***/ [/CODE] I have a lot of variables to …

Member Avatar
Member Avatar
+0 forum 5

![new1.PNG](/attachments/small/4/439e046d2f82534dc014d4649dea2f82.PNG "align-right") ![New.PNG](/attachments/small/4/df936d9cb59970cb9d9624ec2372f01f.PNG "align-right") ![new2.PNG](/attachments/small/4/e4dd164233946b7d726c703c6f7d470f.PNG "align-right") ![new3.PNG](/attachments/small/4/d479a91081ef39aa870d6eb0a3ca5006.PNG "align-right") Good Day, I would like some assistance, I have 12 checkboxes that when you click the value get stored into the database, then unchecked it get removed. Then now I needed a Checkbox/Uncheck All checkbox that when clicked the values get store, then unclick get removed. <b> <span> Check/Uncheck All </span> <input type="checkbox" id="checkall" /> </b>    <script type="text/javascript"> function Select(status) { $("#checkboxes input").each(function () { // Set the checked status of each to match the // checked status of the check all checkbox: $(this).prop("checked", status); }); } $(document).ready(function () { //Set …

Member Avatar
Member Avatar
+0 forum 6

Hi! I have encountered a small issue when attempting to create getters and setters in C#. I've been following along a course in unity and tried to replicate what the tutor had written in his C# scripts. As far as I can tell, everything is spot on and I can't seem to find what's causing the error -- Visual Studio suggests adding semi-colons after the 'get' and 'set' keywords, but I don't think that's correct course of action. Here is a snippet of the code that causes the error. Perhaps someone could explain to me what I'm doing wrong and …

Member Avatar
Member Avatar
+0 forum 3

I am trying to make a windows form application using Visual Basic 2017. I want to display messaged using a label and a Next Button and a Back Button. Every time the Next Button is click I want the message to update and change to whatever you put in your code already. I was think about using If Else statement but somehow i can not get the message to uupdate passed the first display. Thank you. The algorithm will follow like a flowchart because there will also be a Yes/No Button which can also change the displayed messages on the …

Member Avatar
Member Avatar
+0 forum 1

numbers = [2,3,1,5,7,8,9,5,4,6] print(numbers) tool_1 = int(input()) tool_2 = int(input()) x = numbers.index (tool_1) y = numbers.index (tool_2) numbers[x] = (tool_2) numbers[y] = (tool_1) print(numbers) So I want this code to run until the numbers list is in this exact order 1,2,3,4,5,6,7,8,9 Is there a Do until loop or someway I can do this?

Member Avatar
Member Avatar
+0 forum 2

AcedCast5 what is This??

Member Avatar
Member Avatar
-2 forum 1

Hi guys, This is my first post and basically i require some help editing my current code to help display number of students with a mark of 40 or above specifically. And also i am having difficulty generating a average i thought i done it but it remained constant a 4.0 with every test. This work is on going so i will be constantly updating the page each time i run into more troubles. Thanks guys below is a copy of my code and how far i got... package histogram1; import java.util.Scanner; public class Histogram1 public static void main(String[] args) …

Member Avatar
Member Avatar
+0 forum 2

Hi everyone, so i have currently made a small antivirus project (just for me) but i want to make it cool with signiture definitions ect. Basically what ive got so far is my program reads a text file with loads of sha256 hashes to see if the file that enterd the computer has the same sha256 if it reads all text from the text file and the sha256 matches then its removed. If not then well nothing happens ofcourse. But i want to make it cooler, so can anyone walk me through how to make a database (i can add …

Member Avatar
Member Avatar
+0 forum 1

Hello Everyone

Member Avatar
-1 forum 0

command name can be APP_COMMAND_NAME as const Friend Module Program Private CurrentString As String = String.Empty Public Const APP_RUNNING As String = "Running" Public Const APP_TITLE As String = "Console" Public State_Output As String Public State_List As List(Of String) = New List(Of String) Private commandlist_ As Dictionary(Of String, Action) Private State As String = String.Empty Public APP_USER As String Event Command_Run() Sub Main() APP_USER = String.Empty Program.State_Output = "App is " & State.ToString & CStr(Program.APP_RUNNING) 'Program.State_List = New List(Of String) Console.Title = APP_TITLE AddHandler Command_Run, AddressOf RunCommand Program.commandlist_ = New Dictionary(Of String, Action) Program.commandlist_.Add("Notepad", New Action(AddressOf Notepad)) Console.Write(">>") 'Program.CurrentString = …

Member Avatar
Member Avatar
+0 forum 1

My program find the amount of specific word such as "whale" and "thee", but ignore "thee,", "whale....", and so on. How can I contain them? #include<stdio.h> #include<string.h> #include<ctype.h> int main(){ FILE *md,*out; char CHA[255]; char cha[255]; cha[255]=tolower(CHA[255]); char thee[]="thee"; char chapter[]="chapter"; char whale[]="whale"; char meet[]="meet"; int th=0; int ch=0; int wh=0; int me=0; md=fopen("moby_dick.txt","r"); out=fopen("output.txt","w"); if(md==NULL){ printf("Empty text"); return 1; } while(feof(md)==0){ fscanf (md,"%s",&cha); if(strcmp(cha,thee)==0 ){ th++; } if(strcmp(cha,chapter)==0){ ch++; } if(strcmp(cha,whale)==0){ wh++; } if(strcmp(cha,meet)==0){ me++; } } printf("%d\n",th); printf("%d\n",ch); printf("%d\n",wh); printf("%d\n",me); fprintf(out,"%d\n",th); fprintf(out,"%d\n",ch); fprintf(out,"%d\n",wh); fprintf(out,"%d\n",me); fclose(md); fclose(out); }

Member Avatar
Member Avatar
+0 forum 3

G'day everyone! I'm fairly new to C++, so bear with me if this is painfully obvious. I'm trying to get a user to guess a string, which is just a vector containing random capital letters. That random letters part works great, however I can't figure out how to get my program to actually compare user input to the generated string in question. I decided to try a very simple program that would do only this and customize it to fit my main program, but I hit a bit of a bump. I need my program to print out that the …

Member Avatar
Member Avatar
+0 forum 4

# **OLD** # [URL=http://s127.photobucket.com/user/yoda3ddd/media/codemap_zps4115ff7e.jpg.html][IMG]http://i127.photobucket.com/albums/p158/yoda3ddd/codemap_zps4115ff7e.jpg[/IMG][/URL] The Data Namespace Core Friend Module Func Public OkButton As Button Public CancelButton As Button Public ProgBar As ProgressBar Private Sub ProgressLoop() Do Func.ProgBar.PerformStep() Threading.Thread.Sleep(1) Loop End Sub #Region "Constants" Public Const DataRoot As String = "C:\AFormData\" Public Const IMG_PATH As String = "C:\AFormData\img" Public Const LoadImage As String = "C:\AFormData\img\codemap_zps4115ff7e.jpg" Public Const LINE_TERMINATOR As String = ">>" Public Const LoadImageX As Integer = 0 Public Const LoadImageY As Integer = 0 Public Const LoadBarFailedMessage As String = "Loading Bar Denied" Public Const ResizeMessage As String = "Current Form Resizing" Public Const NoCommandMsg As String = …

Member Avatar
Member Avatar
+0 forum 6

Hi, I have written a code for Roman Numeral basic mathematical operation in C++. How to do unit testing for it/ How to write unit testing program for it? Here is the code: #include <iostream> #include <string> using namespace std; //Function to convert decimal number to roman string decimal_to_Roman(int number) { string roman = ""; while (number > 0) { if (number >= 1000) { roman += "M"; number -= 1000; } else if (number >= 500) { roman += "D"; number -= 500; } else if (number >= 100) { roman += "C"; number -= 100; } else if …

Member Avatar
Member Avatar
+0 forum 4

I wonder how to handle exception in `ResponsesEntity`. When it receive wrong url, it supposes to go to the `catch` block and display the `log`. But I keep getting error message in console. The `try-catch` not working as it not display log message. @GetMapping("abc/{Id}") public ResponseEntity info(@PathVariable("Id") String id) { HttpEntity httpEntity = new HttpEntity(buildHttpHeaders()); String theUrl = url + "/xxx ..."; ResponseEntity<TDto> responseEntity = restTemplate.exchange(theUrl, HttpMethod.GET, httpEntity, TDto.class); TDto tdto = responseEntity.getBody(); Tran tran = new Tran(); try { tran.setDate(new Date()); tran.saveAndFlush(tran); // save to database }catch(Exception e) { log.info("Log: "+e); } return responseEntity; } Error org.springframework.web.client.HttpClientErrorException: 404 Not …

Member Avatar
Member Avatar
+0 forum 3

I have a JSON file, and I need to convert some of the entries into anchor tags. I think a regular expression is the way to go, but I'm terrible with them. I need to convert: "id":"1","template_name", into: "<a href='getTemplate?1'>template_name</a>", The text "id" is hard-coded, present in every instance where I need this conversion to happen. The "1" and the "template_name" are variable, changing record by record.

Member Avatar
Member Avatar
+0 forum 1

im trying to make a loop that asks a command from stdin and checks if it's valid or not, and the command for example will be in this format : Command then seperated with any amount of spaces then a Letter then comma then a double a comma and a double example : command A,24.3,7.8 doesnt matter how many spaces there are so it may be : command A, 24.3,7.8 and thought i'd use strtok but not sure how does it work... and to use strtok to recieve a pointer which would be the end of each word, so the …

Member Avatar
Member Avatar
+0 forum 4

Hello, this is John McPherson, writing code for the U.S. Department of Labor. I am working on developing a new Benefit Finanacila Model for the state of Oregon, and I am having a problem with the printing of large numbers that are converted to strings. It works most of the time, but occasionally the least significant digits are dropped. Below is a sample fo the bad output: COMBINED QUARTERLY OUTPUT INSED TOTAL TAXABLE CONTRIBUTIONS BENEFITS ENDING TF INTEREST UNEMP WAGES WAGES BALANCE RATE (000) (000) 2016-1 2.56 16,334,284 14,112,227 149,661,400 133,579,377 2,813,499,313 15,770,753 2016-2 1.95 17,010,421 11,302,061 227,955,435 111,617,704 2,945,720,62 …

Member Avatar
Member Avatar
+0 forum 4

The End.