[Solved] What’s wrong with this program in C++?

[ad_1] This should do the work. #include <iostream> using namespace std; void chap(char,int,int); int main() { int x,z,q; char y; cout<<“do you want run program?”; cin>>x; while(x!=0) { cout<<“enter your character: \n”; cin>>y; cout<<“\nenter the number of lines: \n”; cin>>z; cout<<“enter 1 for normal pattern and enter 0 for unnormal pattern : \n”; cin>>q; chap(y,z,q); … Read more

[Solved] Search and output with Python [closed]

[ad_1] I don’t think I fully understand your question. Posting your code and an example file would have been very helpful. This code will count all entries in all files, then it will identify unique entries per file. After that, it will count each entry’s occurrence in each file. Then, it will select only entries … Read more

[Solved] How to Calculate a Discount In LINQ [closed]

[ad_1] Firstly this code is really starting to need a ViewModel or some other construct that would enable you to decouple your business logic from your UI. Having said that, the quick and dirty answer to get you going, would be to implement an interim linq query and then build your results from that // … Read more

[Solved] Undefined method ‘[]’ for nil:NilClass when trying to write to db in active record [closed]

[ad_1] I figured out the reason for ArgumentError: uncaught throw “Error in record 314675: undefined method ‘[]’ for nil:NilClass’ was primarily from an incomplete set of input variables that is required by the def init method. Because this was an ArgumentError that was thrown from the function1 method, I was only invested in debugging function1. … Read more

[Solved] My program is crahing, and honestly i am confused (c++)

[ad_1] Not likely to be your crash, but this code is terrible: if (fnameFile.is_open()) { while (fnameFile.eof() == false) { plFname.resize(numFnames); getline(fnameFile,line); numFnames += 1; } fnameFile.close(); } It doesn’t check for end of file correctly, because end of file happens during getline, not before. And the line variable goes nowhere. Try while (getline(fnameFile,line)) plFnames.push_back(line); … Read more

[Solved] Make Exceptions work [closed]

[ad_1] There are some flaws in your code: you should prefer int.TryParse instead of Parse. An Exception should be an unexpected behavior, where you have to react in some way. A userinput is not unexpected, you know there’s a chance that the use inputs invalid data which you can/have to validate. When you use exceptions, … Read more

[Solved] How to Map my input data [closed]

[ad_1] Code string str = “VALVE,GATE,SH_NAME:VLV,GATE,VLV_NOM_SIZE:4-1/16IN”; string[] Rows = str.Split(‘,’); dataGridView1.Columns.Add(“Column1”, “Column1”); dataGridView1.Columns.Add(“Column2”, “Column2”); foreach (string AddRow in Rows) { string[] Row = AddRow.Split(‘:’); dataGridView1.Rows.Add(Row); } 2 [ad_2] solved How to Map my input data [closed]

[Solved] Create a link while typing using Jquery [closed]

[ad_1] Although I do not want to make it your habit to take SO as a code for me site but this time here it is for you: var field = document.getElementById(“field”); var link = document.getElementById(“link”); field.onchange = function() { link.href = “http://www.example.com/?q=” + encodeURIComponent(field.value); console.log(link.href); }; Notice I did not code it for you … Read more

[Solved] Java pyramid display

[ad_1] static void staircase(int n) { //int n = scanner.nextInt(); int size = n; for (int i = 0; i <= size-1; i++){ for(int j = 5; j > i; j–){ System.out.print(” “); } for(int j = 0; j <= i; j++){ System.out.print(“#”); } System.out.println(); } output would be: # ## ### #### ##### ###### … Read more